diff --git a/_base/orientb-style.xml b/_base/orientb-style.xml index fb95953754f..3b38d4ae6f1 100644 --- a/_base/orientb-style.xml +++ b/_base/orientb-style.xml @@ -1,12 +1,60 @@ - + + + + \ No newline at end of file diff --git a/client/pom.xml b/client/pom.xml index edae480303d..f92ac3ea4f3 100755 --- a/client/pom.xml +++ b/client/pom.xml @@ -38,6 +38,8 @@ UTF-8 ${project.basedir}/../ + + 2023-01-01T00:00:00Z diff --git a/client/src/main/java/com/orientechnologies/orient/client/binary/OChannelBinaryAsynchClient.java b/client/src/main/java/com/orientechnologies/orient/client/binary/OChannelBinaryAsynchClient.java index e761a1acc0a..e1088af5ff3 100755 --- a/client/src/main/java/com/orientechnologies/orient/client/binary/OChannelBinaryAsynchClient.java +++ b/client/src/main/java/com/orientechnologies/orient/client/binary/OChannelBinaryAsynchClient.java @@ -115,7 +115,8 @@ public OChannelBinaryAsynchClient( + iProtocolVersion + ", server=" + srvProtocolVersion - + ". You could not use the full features of the newer version. Assure to have the same versions on both"); + + ". You could not use the full features of the newer version. Assure to have" + + " the same versions on both"); } } catch (RuntimeException e) { @@ -376,7 +377,8 @@ public void handleException(Throwable throwable) { OLogManager.instance() .error( this, - "Error during exception serialization, serialized exception is not Throwable, exception type is " + "Error during exception serialization, serialized exception is not Throwable," + + " exception type is " + exceptionType, null); } diff --git a/client/src/main/java/com/orientechnologies/orient/client/binary/OChannelBinaryClientAbstract.java b/client/src/main/java/com/orientechnologies/orient/client/binary/OChannelBinaryClientAbstract.java index 3beeef49626..d899d3ee88d 100755 --- a/client/src/main/java/com/orientechnologies/orient/client/binary/OChannelBinaryClientAbstract.java +++ b/client/src/main/java/com/orientechnologies/orient/client/binary/OChannelBinaryClientAbstract.java @@ -121,7 +121,8 @@ public OChannelBinaryClientAbstract( + protocolVersion + ", server=" + srvProtocolVersion - + ". You could not use the full features of the newer version. Assure to have the same versions on both"); + + ". You could not use the full features of the newer version. Assure to have" + + " the same versions on both"); } } catch (RuntimeException e) { @@ -297,7 +298,8 @@ protected void throwSerializedException(final byte[] serializedException) throws OLogManager.instance() .error( this, - "Error during exception serialization, serialized exception is not Throwable, exception type is " + "Error during exception serialization, serialized exception is not Throwable," + + " exception type is " + exceptionType, null); } diff --git a/client/src/main/java/com/orientechnologies/orient/client/db/ODatabaseHelper.java b/client/src/main/java/com/orientechnologies/orient/client/db/ODatabaseHelper.java index 10b731ea321..5a095a5198a 100755 --- a/client/src/main/java/com/orientechnologies/orient/client/db/ODatabaseHelper.java +++ b/client/src/main/java/com/orientechnologies/orient/client/db/ODatabaseHelper.java @@ -223,7 +223,8 @@ protected static File getConfigurationFile(final String iDirectory) { "${" + Orient.ORIENTDB_HOME + "}/config/orientdb-server-config.xml")); if (!file.exists()) throw new OConfigurationException( - "Cannot load file orientdb-server-config.xml to execute remote tests. Current directory is " + "Cannot load file orientdb-server-config.xml to execute remote tests. Current directory" + + " is " + new File(".").getAbsolutePath()); return file; } diff --git a/client/src/main/java/com/orientechnologies/orient/client/remote/ORemoteURLs.java b/client/src/main/java/com/orientechnologies/orient/client/remote/ORemoteURLs.java index 77a43046320..03fff43f940 100644 --- a/client/src/main/java/com/orientechnologies/orient/client/remote/ORemoteURLs.java +++ b/client/src/main/java/com/orientechnologies/orient/client/remote/ORemoteURLs.java @@ -270,7 +270,8 @@ public synchronized String getNextAvailableServerURL( OLogManager.instance() .debug( this, - "ROUND_ROBIN_CONNECT: Next remote operation will be executed on server: %s (isConnectOperation=%s)", + "ROUND_ROBIN_CONNECT: Next remote operation will be executed on server: %s" + + " (isConnectOperation=%s)", url, iIsConnectOperation); break; @@ -280,7 +281,8 @@ public synchronized String getNextAvailableServerURL( OLogManager.instance() .debug( this, - "ROUND_ROBIN_REQUEST: Next remote operation will be executed on server: %s (isConnectOperation=%s)", + "ROUND_ROBIN_REQUEST: Next remote operation will be executed on server: %s" + + " (isConnectOperation=%s)", url, iIsConnectOperation); break; diff --git a/client/src/main/java/com/orientechnologies/orient/client/remote/OSBTreeCollectionManagerRemote.java b/client/src/main/java/com/orientechnologies/orient/client/remote/OSBTreeCollectionManagerRemote.java index c5c3572ea8c..1a8358a9a5e 100755 --- a/client/src/main/java/com/orientechnologies/orient/client/remote/OSBTreeCollectionManagerRemote.java +++ b/client/src/main/java/com/orientechnologies/orient/client/remote/OSBTreeCollectionManagerRemote.java @@ -37,7 +37,9 @@ import java.util.Map; import java.util.UUID; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public class OSBTreeCollectionManagerRemote implements OCloseable, OSBTreeCollectionManager, diff --git a/client/src/main/java/com/orientechnologies/orient/client/remote/OStorageRemote.java b/client/src/main/java/com/orientechnologies/orient/client/remote/OStorageRemote.java index 25f5cc3eb55..4b69e21a856 100755 --- a/client/src/main/java/com/orientechnologies/orient/client/remote/OStorageRemote.java +++ b/client/src/main/java/com/orientechnologies/orient/client/remote/OStorageRemote.java @@ -460,7 +460,8 @@ public T baseNetworkOperation( OStorageRemoteSession session = getCurrentSession(); if (session.commandExecuting) throw new ODatabaseException( - "Cannot execute the request because an asynchronous operation is in progress. Please use a different connection"); + "Cannot execute the request because an asynchronous operation is in progress. Please use" + + " a different connection"); String serverUrl = null; do { @@ -654,15 +655,17 @@ public void reload() { public void create(OContextConfiguration contextConfiguration) { throw new UnsupportedOperationException( - "Cannot create a database in a remote server. Please use the console or the OServerAdmin class."); + "Cannot create a database in a remote server. Please use the console or the OServerAdmin" + + " class."); } public boolean exists() { throw new UnsupportedOperationException( - "Cannot check the existence of a database in a remote server. Please use the console or the OServerAdmin class."); + "Cannot check the existence of a database in a remote server. Please use the console or the" + + " OServerAdmin class."); } - public void close(final boolean iForce, boolean onDelete) { + public void close(final boolean iForce) { if (status == STATUS.CLOSED) return; final OStorageRemoteSession session = getCurrentSession(); @@ -697,7 +700,7 @@ public void shutdown() { if (status == STATUS.CLOSED) return; status = STATUS.CLOSING; - close(true, false); + close(true); } finally { stateLock.writeLock().unlock(); } @@ -752,7 +755,8 @@ public int removeUser() { public void delete() { throw new UnsupportedOperationException( - "Cannot delete a database in a remote server. Please use the console or the OServerAdmin class."); + "Cannot delete a database in a remote server. Please use the console or the OServerAdmin" + + " class."); } public Set getClusterNames() { @@ -976,7 +980,8 @@ public List backup( int bufferSize) throws IOException { throw new UnsupportedOperationException( - "backup is not supported against remote storage. Open the database with plocal or use the incremental backup in the Enterprise Edition"); + "backup is not supported against remote storage. Open the database with plocal or use the" + + " incremental backup in the Enterprise Edition"); } public void restore( @@ -986,7 +991,8 @@ public void restore( final OCommandOutputListener iListener) throws IOException { throw new UnsupportedOperationException( - "restore is not supported against remote storage. Open the database with plocal or use Enterprise Edition"); + "restore is not supported against remote storage. Open the database with plocal or use" + + " Enterprise Edition"); } public OContextConfiguration getClientConfiguration() { @@ -2333,7 +2339,8 @@ public void onPushReconnect(String host) { OLogManager.instance() .warn( this, - "Cannot find a valid session for subscribe for event to host '%s' forward the subscribe for the next session open ", + "Cannot find a valid session for subscribe for event to host '%s' forward the" + + " subscribe for the next session open ", host); OStorageRemotePushThread old; stateLock.writeLock().lock(); @@ -2466,7 +2473,7 @@ public STATUS getStatus() { } public void close() { - close(false, false); + close(false); } public boolean dropCluster(final String iClusterName) { diff --git a/client/src/main/java/com/orientechnologies/orient/client/remote/OStorageRemoteSession.java b/client/src/main/java/com/orientechnologies/orient/client/remote/OStorageRemoteSession.java index e5368dd067e..7d50a1ade3b 100644 --- a/client/src/main/java/com/orientechnologies/orient/client/remote/OStorageRemoteSession.java +++ b/client/src/main/java/com/orientechnologies/orient/client/remote/OStorageRemoteSession.java @@ -47,6 +47,7 @@ public class OStorageRemoteSession { Collections.newSetFromMap(new WeakHashMap()); private final int uniqueClientSessionId; private boolean closed = true; + /** * Make the retry to happen only on the current session, if the current session is invalid or the * server is offline it kill the operation. diff --git a/client/src/main/java/com/orientechnologies/orient/client/remote/db/document/ODatabaseDocumentRemote.java b/client/src/main/java/com/orientechnologies/orient/client/remote/db/document/ODatabaseDocumentRemote.java index 74d2184570e..157439efe61 100755 --- a/client/src/main/java/com/orientechnologies/orient/client/remote/db/document/ODatabaseDocumentRemote.java +++ b/client/src/main/java/com/orientechnologies/orient/client/remote/db/document/ODatabaseDocumentRemote.java @@ -1102,7 +1102,8 @@ public void freeze(final boolean throwException) { OLogManager.instance() .error( this, - "Only local paginated storage supports freeze. If you are using remote client please use OrientDB instance instead", + "Only local paginated storage supports freeze. If you are using remote client please" + + " use OrientDB instance instead", null); return; @@ -1121,7 +1122,8 @@ public void release() { OLogManager.instance() .error( this, - "Only local paginated storage supports release. If you are using remote client please use OrientDB instance instead", + "Only local paginated storage supports release. If you are using remote client please" + + " use OrientDB instance instead", null); return; } diff --git a/client/src/main/java/com/orientechnologies/orient/client/remote/message/OBinaryProtocolHelper.java b/client/src/main/java/com/orientechnologies/orient/client/remote/message/OBinaryProtocolHelper.java index c8b8159e5ff..fcab2fc84bf 100755 --- a/client/src/main/java/com/orientechnologies/orient/client/remote/message/OBinaryProtocolHelper.java +++ b/client/src/main/java/com/orientechnologies/orient/client/remote/message/OBinaryProtocolHelper.java @@ -22,7 +22,8 @@ public static void checkProtocolVersion(Object caller, int protocolVersion) { if (NETWORK_BINARY_MIN_PROTOCOL_VERSION.getValueAsInteger() > protocolVersion) { String message = String.format( - "Backward compatibility support enabled from version %d your version is %d, check `%s` settings", + "Backward compatibility support enabled from version %d your version is %d, check" + + " `%s` settings", NETWORK_BINARY_MIN_PROTOCOL_VERSION.getValueAsInteger(), protocolVersion, NETWORK_BINARY_MIN_PROTOCOL_VERSION.getKey()); diff --git a/client/src/main/java/com/orientechnologies/orient/client/remote/message/sequence/OSequenceActionRequest.java b/client/src/main/java/com/orientechnologies/orient/client/remote/message/sequence/OSequenceActionRequest.java index 1ffc47279ff..82b6e416e0d 100644 --- a/client/src/main/java/com/orientechnologies/orient/client/remote/message/sequence/OSequenceActionRequest.java +++ b/client/src/main/java/com/orientechnologies/orient/client/remote/message/sequence/OSequenceActionRequest.java @@ -23,7 +23,9 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; -/** @author marko */ +/** + * @author marko + */ public class OSequenceActionRequest { private OSequenceAction action = null; diff --git a/client/src/test/java/com/orientechnologies/orient/client/remote/message/sequence/OSequenceActionRequestTest.java b/client/src/test/java/com/orientechnologies/orient/client/remote/message/sequence/OSequenceActionRequestTest.java index 74e1d1dc815..df8213e3902 100644 --- a/client/src/test/java/com/orientechnologies/orient/client/remote/message/sequence/OSequenceActionRequestTest.java +++ b/client/src/test/java/com/orientechnologies/orient/client/remote/message/sequence/OSequenceActionRequestTest.java @@ -27,7 +27,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author marko */ +/** + * @author marko + */ public class OSequenceActionRequestTest { @Test diff --git a/core/pom.xml b/core/pom.xml index 8cac98df094..1f711b6e5f5 100755 --- a/core/pom.xml +++ b/core/pom.xml @@ -26,6 +26,8 @@ 4.0.0 UTF-8 + + 2023-01-01T00:00:00Z @@ -180,7 +182,7 @@ - ${basedir}/src/main/resources + src/main/resources true @@ -188,7 +190,6 @@ org.codehaus.mojo buildnumber-maven-plugin - 3.2.0 validate @@ -201,7 +202,7 @@ org.codehaus.mojo javacc-maven-plugin - 2.6 + 3.0.1 jjtree-javacc diff --git a/core/src/main/java/com/orientechnologies/common/collection/closabledictionary/OClosableLRUList.java b/core/src/main/java/com/orientechnologies/common/collection/closabledictionary/OClosableLRUList.java index 9702516d70c..4fdbaf770d9 100644 --- a/core/src/main/java/com/orientechnologies/common/collection/closabledictionary/OClosableLRUList.java +++ b/core/src/main/java/com/orientechnologies/common/collection/closabledictionary/OClosableLRUList.java @@ -131,7 +131,9 @@ OClosableEntry poll() { return entry; } - /** @return Iterator to iterate from head to the tail. */ + /** + * @return Iterator to iterate from head to the tail. + */ public Iterator> iterator() { return new Iterator>() { private OClosableEntry next = head; diff --git a/core/src/main/java/com/orientechnologies/common/collection/closabledictionary/OClosableLinkedContainer.java b/core/src/main/java/com/orientechnologies/common/collection/closabledictionary/OClosableLinkedContainer.java index 51c6ad03e81..1254c4b3d98 100755 --- a/core/src/main/java/com/orientechnologies/common/collection/closabledictionary/OClosableLinkedContainer.java +++ b/core/src/main/java/com/orientechnologies/common/collection/closabledictionary/OClosableLinkedContainer.java @@ -395,7 +395,8 @@ public void clear() { stateBuffer.clear(); - while (lruList.poll() != null) ; + while (lruList.poll() != null) + ; } finally { lruLock.unlock(); } @@ -788,7 +789,9 @@ private void evict() { OLogManager.instance() .debug( this, - "Reached maximum of opened files %d (max=%d), closed %d files. Consider to raise this limit by increasing the global setting '%s' and the OS limit on opened files per processor", + "Reached maximum of opened files %d (max=%d), closed %d files. Consider to raise this" + + " limit by increasing the global setting '%s' and the OS limit on opened files" + + " per processor", initialSize, openLimit, closedFiles, diff --git a/core/src/main/java/com/orientechnologies/common/console/OCommandStream.java b/core/src/main/java/com/orientechnologies/common/console/OCommandStream.java index 5cff1500c37..282a62dd485 100755 --- a/core/src/main/java/com/orientechnologies/common/console/OCommandStream.java +++ b/core/src/main/java/com/orientechnologies/common/console/OCommandStream.java @@ -22,7 +22,9 @@ import com.orientechnologies.common.concur.resource.OCloseable; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public interface OCommandStream extends OCloseable { boolean hasNext(); diff --git a/core/src/main/java/com/orientechnologies/common/console/OConsoleApplication.java b/core/src/main/java/com/orientechnologies/common/console/OConsoleApplication.java index 449dc490630..a41f474dc8d 100755 --- a/core/src/main/java/com/orientechnologies/common/console/OConsoleApplication.java +++ b/core/src/main/java/com/orientechnologies/common/console/OConsoleApplication.java @@ -565,7 +565,11 @@ protected Method getMethod(String iCommand) { protected void syntaxError(String iCommand, Method m) { error( - "\n!Wrong syntax. If you're running in batch mode make sure all commands are delimited by semicolon (;) or a linefeed (\\n). Expected: \n\r\n\r%s", + "\n" + + "!Wrong syntax. If you're running in batch mode make sure all commands are delimited" + + " by semicolon (;) or a linefeed (\\n" + + "). Expected: \n\r\n\r" + + "%s", formatCommandSpecs(iCommand, m)); } @@ -685,7 +689,8 @@ protected Map addCommand(Map commandsTree, Strin @ConsoleCommand( splitInWords = false, description = - "Receives help on available commands or a specific one. Use 'help -online ' to fetch online documentation") + "Receives help on available commands or a specific one. Use 'help -online ' to fetch" + + " online documentation") public void help( @ConsoleParameter(name = "command", description = "Command to receive help") String iCommand) { @@ -727,7 +732,8 @@ public void help( // } catch (Exception e) { // } error( - "!CANNOT FETCH ONLINE DOCUMENTATION, CHECK IF COMPUTER IS CONNECTED TO THE INTERNET."); + "!CANNOT FETCH ONLINE DOCUMENTATION, CHECK IF COMPUTER IS CONNECTED TO THE" + + " INTERNET."); return; } diff --git a/core/src/main/java/com/orientechnologies/common/console/OConsoleCommandStream.java b/core/src/main/java/com/orientechnologies/common/console/OConsoleCommandStream.java index 1a55580e69f..53651f0f8d2 100755 --- a/core/src/main/java/com/orientechnologies/common/console/OConsoleCommandStream.java +++ b/core/src/main/java/com/orientechnologies/common/console/OConsoleCommandStream.java @@ -28,7 +28,9 @@ import java.io.Reader; import java.io.StringReader; -/** @author Luigi Dell'Aquila */ +/** + * @author Luigi Dell'Aquila + */ public class OConsoleCommandStream implements OCommandStream { public static final int BUFFER_SIZE = 1024; private Reader reader; diff --git a/core/src/main/java/com/orientechnologies/common/directmemory/OByteBufferPool.java b/core/src/main/java/com/orientechnologies/common/directmemory/OByteBufferPool.java index f1453012d2f..0ff57a12623 100755 --- a/core/src/main/java/com/orientechnologies/common/directmemory/OByteBufferPool.java +++ b/core/src/main/java/com/orientechnologies/common/directmemory/OByteBufferPool.java @@ -52,7 +52,9 @@ public final class OByteBufferPool implements OByteBufferPoolMXBean { /** Limit of direct memory pointers are hold inside of the pool */ private final int poolSize; - /** @return Singleton instance */ + /** + * @return Singleton instance + */ public static OByteBufferPool instance(OContextConfiguration contextConfiguration) { final OByteBufferPool instance = INSTANCE_HOLDER.get(); if (instance != null) { @@ -171,7 +173,9 @@ public final void release(OPointer pointer) { } } - /** @inheritDoc */ + /** + * @inheritDoc + */ @Override public final int getPoolSize() { return pointersPoolSize.get(); diff --git a/core/src/main/java/com/orientechnologies/common/directmemory/OByteBufferPoolMXBean.java b/core/src/main/java/com/orientechnologies/common/directmemory/OByteBufferPoolMXBean.java index eedd54fc418..93ba3b7b286 100755 --- a/core/src/main/java/com/orientechnologies/common/directmemory/OByteBufferPoolMXBean.java +++ b/core/src/main/java/com/orientechnologies/common/directmemory/OByteBufferPoolMXBean.java @@ -24,6 +24,8 @@ * @author Sergey Sitnikov */ public interface OByteBufferPoolMXBean { - /** @return Current size of the memory pool */ + /** + * @return Current size of the memory pool + */ int getPoolSize(); } diff --git a/core/src/main/java/com/orientechnologies/common/directmemory/ODirectMemoryAllocator.java b/core/src/main/java/com/orientechnologies/common/directmemory/ODirectMemoryAllocator.java index 26cae55e06e..eb40445ff73 100755 --- a/core/src/main/java/com/orientechnologies/common/directmemory/ODirectMemoryAllocator.java +++ b/core/src/main/java/com/orientechnologies/common/directmemory/ODirectMemoryAllocator.java @@ -113,7 +113,9 @@ public class ODirectMemoryAllocator implements ODirectMemoryAllocatorMXBean { private final ReferenceQueue consumptionMapEvictionQueue = new ReferenceQueue<>(); - /** @return singleton instance. */ + /** + * @return singleton instance. + */ public static ODirectMemoryAllocator instance() { final ODirectMemoryAllocator inst = INSTANCE_HOLDER.get(); if (inst != null) { @@ -306,7 +308,9 @@ private static String printMemoryStatistics( return stringBuilder.toString(); } - /** @inheritDoc */ + /** + * @inheritDoc + */ @Override public long getMemoryConsumption() { return memoryConsumption.longValue(); @@ -321,7 +325,8 @@ public void checkMemoryLeaks() { OLogManager.instance() .warnNoDb( this, - "DIRECT-TRACK: memory consumption is not zero (%d bytes), it may indicate presence of memory leaks", + "DIRECT-TRACK: memory consumption is not zero (%d bytes), it may indicate presence" + + " of memory leaks", memCons); assert false; diff --git a/core/src/main/java/com/orientechnologies/common/directmemory/ODirectMemoryAllocatorMXBean.java b/core/src/main/java/com/orientechnologies/common/directmemory/ODirectMemoryAllocatorMXBean.java index 264190b7ed9..e41b2961793 100755 --- a/core/src/main/java/com/orientechnologies/common/directmemory/ODirectMemoryAllocatorMXBean.java +++ b/core/src/main/java/com/orientechnologies/common/directmemory/ODirectMemoryAllocatorMXBean.java @@ -21,6 +21,8 @@ package com.orientechnologies.common.directmemory; public interface ODirectMemoryAllocatorMXBean { - /** @return Amount of direct memory allocated using this allocator */ + /** + * @return Amount of direct memory allocated using this allocator + */ long getMemoryConsumption(); } diff --git a/core/src/main/java/com/orientechnologies/common/factory/OConfigurableStatefulFactory.java b/core/src/main/java/com/orientechnologies/common/factory/OConfigurableStatefulFactory.java index 8eb131ca82d..8e936d6536f 100755 --- a/core/src/main/java/com/orientechnologies/common/factory/OConfigurableStatefulFactory.java +++ b/core/src/main/java/com/orientechnologies/common/factory/OConfigurableStatefulFactory.java @@ -50,7 +50,8 @@ public V newInstance(final K iKey) { final OSystemException exception = new OSystemException( String.format( - "Error on creating new instance of class '%s' registered in factory with key '%s'", + "Error on creating new instance of class '%s' registered in factory with key" + + " '%s'", cls, iKey)); throw OException.wrapException(exception, e); } diff --git a/core/src/main/java/com/orientechnologies/common/hash/OMurmurHash3.java b/core/src/main/java/com/orientechnologies/common/hash/OMurmurHash3.java index 495444091f8..f48c605cd42 100644 --- a/core/src/main/java/com/orientechnologies/common/hash/OMurmurHash3.java +++ b/core/src/main/java/com/orientechnologies/common/hash/OMurmurHash3.java @@ -20,7 +20,9 @@ package com.orientechnologies.common.hash; -/** @since 13.08.12 */ +/** + * @since 13.08.12 + */ public class OMurmurHash3 { private static class State { private long h1; diff --git a/core/src/main/java/com/orientechnologies/common/io/OFileUtils.java b/core/src/main/java/com/orientechnologies/common/io/OFileUtils.java index cd50d0ab038..7a338564411 100755 --- a/core/src/main/java/com/orientechnologies/common/io/OFileUtils.java +++ b/core/src/main/java/com/orientechnologies/common/io/OFileUtils.java @@ -259,7 +259,8 @@ public static void atomicMoveWithFallback(Path source, Path target, Object reque OLogManager.instance() .warn( requester, - "atomic file move is not possible, falling back to regular move (moving '%s' to '%s')", + "atomic file move is not possible, falling back to regular move (moving '%s' to" + + " '%s')", source, target); Files.move(source, target); diff --git a/core/src/main/java/com/orientechnologies/common/io/OIOUtils.java b/core/src/main/java/com/orientechnologies/common/io/OIOUtils.java index e46ff460bdc..498d79708f3 100755 --- a/core/src/main/java/com/orientechnologies/common/io/OIOUtils.java +++ b/core/src/main/java/com/orientechnologies/common/io/OIOUtils.java @@ -19,7 +19,7 @@ */ package com.orientechnologies.common.io; -import com.orientechnologies.common.jnr.ONative; +import com.orientechnologies.common.log.OLogManager; import com.orientechnologies.common.util.OPatternConst; import java.io.BufferedReader; import java.io.BufferedWriter; @@ -36,15 +36,16 @@ import java.nio.channels.FileChannel; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Calendar; import java.util.Date; -import java.util.List; import java.util.Locale; public class OIOUtils { + public static final long SECOND = 1000; public static final long MINUTE = SECOND * 60; public static final long HOUR = MINUTE * 60; @@ -54,11 +55,15 @@ public class OIOUtils { public static final String UTF8_BOM = "\uFEFF"; public static long getTimeAsMillisecs(final Object iSize) { - if (iSize == null) throw new IllegalArgumentException("Time is null"); + if (iSize == null) { + throw new IllegalArgumentException("Time is null"); + } if (iSize instanceof Number) - // MILLISECS + // MILLISECS + { return ((Number) iSize).longValue(); + } String time = iSize.toString(); @@ -71,32 +76,47 @@ public static long getTimeAsMillisecs(final Object iSize) { } if (number) - // MILLISECS + // MILLISECS + { return Long.parseLong(time); - else { + } else { time = time.toUpperCase(Locale.ENGLISH); int pos = time.indexOf("MS"); final String timeAsNumber = OPatternConst.PATTERN_NUMBERS.matcher(time).replaceAll(""); - if (pos > -1) return Long.parseLong(timeAsNumber); + if (pos > -1) { + return Long.parseLong(timeAsNumber); + } pos = time.indexOf("S"); - if (pos > -1) return Long.parseLong(timeAsNumber) * SECOND; + if (pos > -1) { + return Long.parseLong(timeAsNumber) * SECOND; + } pos = time.indexOf("M"); - if (pos > -1) return Long.parseLong(timeAsNumber) * MINUTE; + if (pos > -1) { + return Long.parseLong(timeAsNumber) * MINUTE; + } pos = time.indexOf("H"); - if (pos > -1) return Long.parseLong(timeAsNumber) * HOUR; + if (pos > -1) { + return Long.parseLong(timeAsNumber) * HOUR; + } pos = time.indexOf("D"); - if (pos > -1) return Long.parseLong(timeAsNumber) * DAY; + if (pos > -1) { + return Long.parseLong(timeAsNumber) * DAY; + } pos = time.indexOf('W'); - if (pos > -1) return Long.parseLong(timeAsNumber) * WEEK; + if (pos > -1) { + return Long.parseLong(timeAsNumber) * WEEK; + } pos = time.indexOf('Y'); - if (pos > -1) return Long.parseLong(timeAsNumber) * YEAR; + if (pos > -1) { + return Long.parseLong(timeAsNumber) * YEAR; + } // RE-THROW THE EXCEPTION throw new IllegalArgumentException("Time '" + time + "' has a unrecognizable format"); @@ -104,12 +124,24 @@ public static long getTimeAsMillisecs(final Object iSize) { } public static String getTimeAsString(final long iTime) { - if (iTime > YEAR && iTime % YEAR == 0) return String.format("%dy", iTime / YEAR); - if (iTime > WEEK && iTime % WEEK == 0) return String.format("%dw", iTime / WEEK); - if (iTime > DAY && iTime % DAY == 0) return String.format("%dd", iTime / DAY); - if (iTime > HOUR && iTime % HOUR == 0) return String.format("%dh", iTime / HOUR); - if (iTime > MINUTE && iTime % MINUTE == 0) return String.format("%dm", iTime / MINUTE); - if (iTime > SECOND && iTime % SECOND == 0) return String.format("%ds", iTime / SECOND); + if (iTime > YEAR && iTime % YEAR == 0) { + return String.format("%dy", iTime / YEAR); + } + if (iTime > WEEK && iTime % WEEK == 0) { + return String.format("%dw", iTime / WEEK); + } + if (iTime > DAY && iTime % DAY == 0) { + return String.format("%dd", iTime / DAY); + } + if (iTime > HOUR && iTime % HOUR == 0) { + return String.format("%dh", iTime / HOUR); + } + if (iTime > MINUTE && iTime % MINUTE == 0) { + return String.format("%dm", iTime / MINUTE); + } + if (iTime > SECOND && iTime % SECOND == 0) { + return String.format("%ds", iTime / SECOND); + } // MILLISECONDS return String.format("%dms", iTime); @@ -141,55 +173,42 @@ public static String readStreamAsString(final InputStream iStream) throws IOExce public static String readStreamAsString(final InputStream iStream, Charset iCharset) throws IOException { - final StringBuffer fileData = new StringBuffer(1000); - final BufferedReader reader = new BufferedReader(new InputStreamReader(iStream, iCharset)); - try { + final StringBuilder fileData = new StringBuilder(1000); + try (BufferedReader reader = new BufferedReader(new InputStreamReader(iStream, iCharset))) { final char[] buf = new char[1024]; - int numRead = 0; + int numRead; while ((numRead = reader.read(buf)) != -1) { String readData = String.valueOf(buf, 0, numRead); - if (fileData.length() == 0 && readData.startsWith(UTF8_BOM)) - // SKIP UTF-8 BOM IF ANY + if (fileData.isEmpty() && readData.startsWith(UTF8_BOM)) + // SKIP UTF-8 BOM IF ANY + { readData = readData.substring(1); + } fileData.append(readData); } - } finally { - reader.close(); } return fileData.toString(); } public static void writeFile(final File iFile, final String iContent) throws IOException { - final FileOutputStream fos = new FileOutputStream(iFile); - try { - final OutputStreamWriter os = new OutputStreamWriter(fos); - try { - final BufferedWriter writer = new BufferedWriter(os); - try { + try (FileOutputStream fos = new FileOutputStream(iFile)) { + try (OutputStreamWriter os = new OutputStreamWriter(fos)) { + try (BufferedWriter writer = new BufferedWriter(os)) { writer.write(iContent); - } finally { - writer.close(); } - } finally { - os.close(); } - } finally { - fos.close(); } } - public static long copyStream(final InputStream in, final OutputStream out) throws IOException { + public static void copyStream(final InputStream in, final OutputStream out) throws IOException { final byte[] buf = new byte[8192]; - int byteRead = 0; - long byteTotal = 0; + int byteRead; while ((byteRead = in.read(buf)) != -1) { out.write(buf, 0, byteRead); - byteTotal += byteRead; } - return byteTotal; } /** Returns the Unix file name format converting backslashes (\) to slasles (/) */ @@ -200,37 +219,29 @@ public static String getUnixFileName(final String iFileName) { public static String getRelativePathIfAny(final String iDatabaseURL, final String iBasePath) { if (iBasePath == null) { final int pos = iDatabaseURL.lastIndexOf('/'); - if (pos > -1) return iDatabaseURL.substring(pos + 1); + if (pos > -1) { + return iDatabaseURL.substring(pos + 1); + } } else { final int pos = iDatabaseURL.indexOf(iBasePath); - if (pos > -1) return iDatabaseURL.substring(pos + iBasePath.length() + 1); + if (pos > -1) { + return iDatabaseURL.substring(pos + iBasePath.length() + 1); + } } return iDatabaseURL; } - public static String getDatabaseNameFromPath(final String iPath) { - return iPath.replace('/', '$'); - } - public static String getPathFromDatabaseName(final String iPath) { return iPath.replace('$', '/'); } - public static String getStringMaxLength(final String iText, final int iMax) { - return getStringMaxLength(iText, iMax, ""); - } - - public static String getStringMaxLength(final String iText, final int iMax, final String iOther) { - if (iText == null) return null; - if (iMax > iText.length()) return iText; - return iText.substring(0, iMax) + iOther; - } - public static Object encode(final Object iValue) { if (iValue instanceof String) { return java2unicode(((String) iValue).replace("\\", "\\\\").replace("\"", "\\\"")); - } else return iValue; + } else { + return iValue; + } } public static String java2unicode(final String iInput) { @@ -243,14 +254,14 @@ public static String java2unicode(final String iInput) { ch = iInput.charAt(i); if (ch >= 0x0020 && ch <= 0x007e) // Does the char need to be converted to unicode? - result.append(ch); // No. - else // Yes. + { + result.append(ch); // No. + } else // Yes. { result.append("\\u"); // standard unicode format. hex = Integer.toHexString(ch & 0xFFFF); // Get hex value of the char. - for (int j = 0; j < 4 - hex.length(); j++) - // Prepend zeros because unicode requires 4 digits - result.append('0'); + // Prepend zeros because unicode requires 4 digits + result.append("0".repeat(4 - hex.length())); result.append(hex.toLowerCase(Locale.ENGLISH)); // standard unicode format. // ostr.append(hex.toLowerCase(Locale.ENGLISH)); } @@ -278,27 +289,14 @@ public static String encodeJsonString(final String iInput) { // escape " with \" result.append('\\'); result.append(ch); - } else if (ch == '\n') { - // escape newline with \" - result.append('\\'); - result.append(ch); - } else if (ch == '\t') { - // escape tab with \" - result.append('\\'); - result.append(ch); - } else if (ch == '\r') { - // escape carriage return with \" - result.append('\\'); - result.append(ch); } else { result.append(ch); } } else { result.append("\\u"); // standard unicode format. hex = Integer.toHexString(ch & 0xFFFF); // Get hex value of the char. - for (int j = 0; j < 4 - hex.length(); j++) - // Prepend zeros because unicode requires 4 digits - result.append('0'); + // Prepend zeros because unicode requires 4 digits + result.append("0".repeat(4 - hex.length())); result.append(hex.toLowerCase(Locale.ENGLISH)); // standard unicode format. // ostr.append(hex.toLowerCase(Locale.ENGLISH)); } @@ -308,11 +306,15 @@ public static String encodeJsonString(final String iInput) { } public static boolean isStringContent(final Object iValue) { - if (iValue == null) return false; + if (iValue == null) { + return false; + } final String s = iValue.toString(); - if (s == null) return false; + if (s == null) { + return false; + } return s.length() > 1 && (s.charAt(0) == '\'' && s.charAt(s.length() - 1) == '\'' @@ -320,37 +322,53 @@ public static boolean isStringContent(final Object iValue) { } public static String getStringContent(final Object iValue) { - if (iValue == null) return null; + if (iValue == null) { + return null; + } final String s = iValue.toString(); - if (s == null) return null; + if (s == null) { + return null; + } if (s.length() > 1 && (s.charAt(0) == '\'' && s.charAt(s.length() - 1) == '\'' - || s.charAt(0) == '"' && s.charAt(s.length() - 1) == '"')) + || s.charAt(0) == '"' && s.charAt(s.length() - 1) == '"')) { return s.substring(1, s.length() - 1); + } - if (s.length() > 1 && (s.charAt(0) == '`' && s.charAt(s.length() - 1) == '`')) + if (s.length() > 1 && (s.charAt(0) == '`' && s.charAt(s.length() - 1) == '`')) { return s.substring(1, s.length() - 1); + } return s; } public static String wrapStringContent(final Object iValue, final char iStringDelimiter) { - if (iValue == null) return null; + if (iValue == null) { + return null; + } final String s = iValue.toString(); - if (s == null) return null; + if (s == null) { + return null; + } return iStringDelimiter + s + iStringDelimiter; } public static boolean equals(final byte[] buffer, final byte[] buffer2) { - if (buffer == null || buffer2 == null || buffer.length != buffer2.length) return false; + if (buffer == null || buffer2 == null || buffer.length != buffer2.length) { + return false; + } - for (int i = 0; i < buffer.length; ++i) if (buffer[i] != buffer2[i]) return false; + for (int i = 0; i < buffer.length; ++i) { + if (buffer[i] != buffer2[i]) { + return false; + } + } return true; } @@ -360,8 +378,9 @@ public static boolean isLong(final String iText) { final int size = iText.length(); for (int i = 0; i < size && isLong; i++) { final char c = iText.charAt(i); - isLong = isLong & ((c >= '0' && c <= '9')); + isLong = c >= '0' && c <= '9'; } + return isLong; } @@ -387,12 +406,14 @@ public static void readByteBuffer( buffer.position(read); final int r = channel.read(buffer, position + read); - if (r < 0) - if (throwOnEof) throw new EOFException("End of file is reached"); - else { + if (r < 0) { + if (throwOnEof) { + throw new EOFException("End of file is reached"); + } else { buffer.put(new byte[buffer.remaining()]); return; } + } read += r; } @@ -407,7 +428,9 @@ public static void readByteBuffer(ByteBuffer buffer, FileChannel channel) throws buffer.position(read); final int r = channel.read(buffer); - if (r < 0) throw new EOFException("End of file is reached"); + if (r < 0) { + throw new EOFException("End of file is reached"); + } read += r; } @@ -435,75 +458,26 @@ private static boolean compareStartIgnoreCase(String contaner, String contained) public static boolean isOsWindows() { String osName = System.getProperty("os.name").split(" ")[0]; - if (compareStartIgnoreCase(osName, "windows")) { - return true; - - } else { - return false; - } + return compareStartIgnoreCase(osName, "windows"); } public static boolean isOsLinux() { String osName = System.getProperty("os.name").split(" ")[0]; - if (compareStartIgnoreCase(osName, "linux")) { - return true; - } else { - return false; - } + return compareStartIgnoreCase(osName, "linux"); } public static int calculateBlockSize(String path) { - if (!isOsLinux()) { - return -1; - } - - final int linuxVersion = 0; - final int majorRev = 1; - final int minorRev = 2; - - List versionNumbers = new ArrayList<>(); - for (String v : System.getProperty("os.version").split("[.\\-]")) { - if (v.matches("\\d")) { - versionNumbers.add(Integer.parseInt(v)); - } - } - - if (versionNumbers.get(linuxVersion) < 2) { - return -1; - } else if (versionNumbers.get(linuxVersion) == 2) { - if (versionNumbers.get(majorRev) < 4) { - return -1; - } else if (versionNumbers.get(majorRev) == 4 && versionNumbers.get(minorRev) < 10) { - return -1; - } - } - - int fsBlockSize = (int) ONative.instance().blockSize(path); - int pageSize = ONative.instance().getpagesize(); - fsBlockSize = lcm(fsBlockSize, pageSize); - - // just being completely paranoid: - // (512 is the rule for 2.6+ kernels) - fsBlockSize = lcm(fsBlockSize, 512); - - if (fsBlockSize <= 0 || ((fsBlockSize & (fsBlockSize - 1)) != 0)) { - return -1; - } - - return fsBlockSize; - } - - private static int lcm(long x, long y) { - long g = x; // will hold gcd - long yc = y; - - // get the gcd first - while (yc != 0) { - long t = g; - g = yc; - yc = t % yc; + try { + var fileStore = Files.getFileStore(Paths.get(path)); + return (int) fileStore.getBlockSize(); + } catch (IOException | UnsupportedOperationException e) { + OLogManager.instance() + .errorNoDb( + OIOUtils.class, + "Error during calculation file system " + + "block size, falling back to default one - 4K", + e); + return 4 * 1024; } - - return (int) (x * y / g); } } diff --git a/core/src/main/java/com/orientechnologies/common/jnr/ONative.java b/core/src/main/java/com/orientechnologies/common/jnr/ONative.java index 28f99118458..6057a332766 100755 --- a/core/src/main/java/com/orientechnologies/common/jnr/ONative.java +++ b/core/src/main/java/com/orientechnologies/common/jnr/ONative.java @@ -103,7 +103,8 @@ public int getOpenFilesLimit(boolean verbose, int recommended, int defLimit) { OLogManager.instance() .warnNoDb( this, - "Value of limit of simultaneously open files is too small, recommended value is %d", + "Value of limit of simultaneously open files is too small, recommended value is" + + " %d", recommended); } return (int) rLimit.rlimCur() / 2 - 512; @@ -213,8 +214,8 @@ public MemoryLimitResult getMemoryLimit(final boolean printSteps) { OLogManager.instance() .infoNoDb( this, - "Can not find '%s' path for memory cgroup, it is supposed that " - + "process is running in container, will try to read root '%s' memory cgroup data", + "Can not find '%s' path for memory cgroup, it is supposed that process is" + + " running in container, will try to read root '%s' memory cgroup data", memoryCGroup, memoryCGroupRoot); } @@ -412,7 +413,8 @@ private String findMemoryGCGroupPath() { OLogManager.instance() .errorNoDb( this, - "Error during closing of reader which reads details of list of cgroups for the current process", + "Error during closing of reader which reads details of list of cgroups for the" + + " current process", e); } } catch (final FileNotFoundException fnfe) { diff --git a/core/src/main/java/com/orientechnologies/common/profiler/OAbstractProfiler.java b/core/src/main/java/com/orientechnologies/common/profiler/OAbstractProfiler.java index eb658f94278..70d3f79e3ca 100755 --- a/core/src/main/java/com/orientechnologies/common/profiler/OAbstractProfiler.java +++ b/core/src/main/java/com/orientechnologies/common/profiler/OAbstractProfiler.java @@ -126,7 +126,9 @@ public void run() { OLogManager.instance() .info( this, - "Database '%s' uses %,dMB/%,dMB of DISKCACHE memory, while Heap is not completely used (usedHeap=%dMB maxHeap=%dMB). To improve performance set maxHeap to %dMB and DISKCACHE to %dMB", + "Database '%s' uses %,dMB/%,dMB of DISKCACHE memory, while Heap is not" + + " completely used (usedHeap=%dMB maxHeap=%dMB). To improve performance" + + " set maxHeap to %dMB and DISKCACHE to %dMB", s.getName(), totalDiskCacheUsedMemory, maxDiskCacheUsedMemory, @@ -138,7 +140,8 @@ public void run() { OLogManager.instance() .info( this, - "-> Open server.sh (or server.bat on Windows) and change the following variables: 1) MAXHEAP=-Xmx%dM 2) MAXDISKCACHE=%d", + "-> Open server.sh (or server.bat on Windows) and change the following" + + " variables: 1) MAXHEAP=-Xmx%dM 2) MAXDISKCACHE=%d", suggestedMaxHeap / OFileUtils.MEGABYTE, suggestedDiskCache); } @@ -206,7 +209,8 @@ public static String dumpEnvironment(final String dumpType) { buffer.append( String.format( - "OrientDB Memory profiler: HEAP=%s of %s - DISKCACHE (%s dbs)=%s of %s - OS=%s of %s - FS=%s of %s", + "OrientDB Memory profiler: HEAP=%s of %s - DISKCACHE (%s dbs)=%s of %s - OS=%s of" + + " %s - FS=%s of %s", OFileUtils.getSizeAsString(runtime.totalMemory() - runtime.freeMemory()), OFileUtils.getSizeAsString(runtime.maxMemory()), stgs, @@ -333,7 +337,9 @@ else if (h.startsWith("db.") && h.endsWith("txRollback")) buffer.append( String.format( - "\nCRUD: C(%d %d/sec) R(%d %d/sec) U(%d %d/sec) D(%d %d/sec) - COMMANDS (%d %d/sec) - TX: COMMIT(%d %d/sec) ROLLBACK(%d %d/sec)", + "\n" + + "CRUD: C(%d %d/sec) R(%d %d/sec) U(%d %d/sec) D(%d %d/sec) - COMMANDS (%d" + + " %d/sec) - TX: COMMIT(%d %d/sec) ROLLBACK(%d %d/sec)", lastCreateRecords, lastCreateRecordsSec, lastReadRecords, @@ -509,14 +515,16 @@ public void setAutoDump(final int iSeconds) { OGlobalConfiguration.PROFILER_AUTODUMP_TYPE.getValueAsString(); output.append( - "\n*******************************************************************************************************************************************"); + "\n" + + "*******************************************************************************************************************************************"); output.append( "\nPROFILER AUTO DUMP '" + dumpType + "' OUTPUT (to disabled it set 'profiler.autoDump.interval' = 0):\n"); output.append(dump(dumpType)); output.append( - "\n*******************************************************************************************************************************************"); + "\n" + + "*******************************************************************************************************************************************"); OLogManager.instance().info(null, output.toString()); }, diff --git a/core/src/main/java/com/orientechnologies/common/serialization/types/OBinarySerializer.java b/core/src/main/java/com/orientechnologies/common/serialization/types/OBinarySerializer.java index 8b7f9734c1b..6bbc2adbd68 100755 --- a/core/src/main/java/com/orientechnologies/common/serialization/types/OBinarySerializer.java +++ b/core/src/main/java/com/orientechnologies/common/serialization/types/OBinarySerializer.java @@ -69,10 +69,14 @@ public interface OBinarySerializer { */ T deserialize(byte[] stream, int startPosition); - /** @return Identifier of given serializer. */ + /** + * @return Identifier of given serializer. + */ byte getId(); - /** @return true if binary presentation of object always has the same length. */ + /** + * @return true if binary presentation of object always has the same length. + */ boolean isFixedLength(); /** @@ -117,12 +121,9 @@ public interface OBinarySerializer { * Serializes binary presentation of object to {@link ByteBuffer}. Position of buffer should be * set before calling of given method. Serialization result is compatible with result of call of * {@link #serializeNativeObject(Object, byte[], int, Object...)} method. So if we call: - * buffer.position(10); - * binarySerializer.serializeInByteBufferObject(object, buffer); + * buffer.position(10); binarySerializer.serializeInByteBufferObject(object, buffer); * and then - * byte[] stream = new byte[serializedSize + 10]; - * buffer.position(10); - * buffer.get(stream); + * byte[] stream = new byte[serializedSize + 10]; buffer.position(10); buffer.get(stream); * following assert should pass * assert object.equals(binarySerializer.deserializeNativeObject(stream, 10)) * Final position of ByteBuffer will be changed and will be equal to sum of @@ -137,14 +138,11 @@ public interface OBinarySerializer { /** * Converts binary presentation of object to object instance. Position of buffer should be set * before call of this method. Binary format of method is expected to be the same as binary format - * of {@link #serializeNativeObject(Object, byte[], int, Object...)} So if we call - * byte[] stream = new byte[serializedSize]; - * binarySerializer.serializeNativeObject(object, stream, 0); + * of {@link #serializeNativeObject(Object, byte[], int, Object...)} So if we call byte[] + * stream = new byte[serializedSize]; binarySerializer.serializeNativeObject(object, stream, 0); * following assert should pass - * byteBuffer.position(10); - * byteBuffer.put(stream); - * byteBuffer.position(10); - * assert object.equals(binarySerializer.deserializeFromByteBufferObject(buffer)) + * byteBuffer.position(10); byteBuffer.put(stream); byteBuffer.position(10); assert + * object.equals(binarySerializer.deserializeFromByteBufferObject(buffer)) * Final position of ByteBuffer will be changed and will be equal to sum of * buffer start position and value returned by method {@link #getObjectSize(Object, Object...)} * @@ -153,6 +151,23 @@ public interface OBinarySerializer { */ T deserializeFromByteBufferObject(ByteBuffer buffer); + /** + * Converts binary presentation of object to object instance. Binary format of method is expected + * to be the same as binary format of {@link #serializeNativeObject(Object, byte[], int, + * Object...)}. So if we call byte[] + * stream = new byte[serializedSize]; binarySerializer.serializeNativeObject(object, stream, 0); + * following assert should pass + * byteBuffer.position(10); byteBuffer.put(stream); byteBuffer.position(10); assert + * object.equals(binarySerializer.deserializeFromByteBufferObject(buffer, 10)) + * Final position of ByteBuffer will NOT be changed during the call. + * + * @param offset offset inside the ByteBuffer from which deserialization should be + * started. + * @param buffer Buffer which contains serialized presentation of object + * @return Instance of object serialized in buffer. + */ + T deserializeFromByteBufferObject(int offset, ByteBuffer buffer); + /** * Returns amount of bytes which is consumed by object which is already serialized in buffer. * Position of buffer should be set before call of this method. Result of call should be the same @@ -163,19 +178,34 @@ public interface OBinarySerializer { */ int getObjectSizeInByteBuffer(ByteBuffer buffer); + /** + * Returns amount of bytes which is consumed by object which is already serialized in buffer. + * Result of call should be the same as result of call of {@link #getObjectSize(Object, + * Object...)} on deserialized object. + * + *

Position of ByteBuffer is not changed after result of the call. + * + * @param buffer Buffer which contains serialized version of object + * @param offset offset inside the buffer since which object is serialized. + * @return Size of serialized object. + */ + int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer); + /** * Converts binary presentation of object to object instance taking in account changes which are * done inside of atomic operation {@link * com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations.OAtomicOperation}. * Binary format of method is expected to be the same as binary format of method {@link - * #serializeNativeObject(Object, byte[], int, Object...)}. So if we call: - * byte[] stream = new byte[serializedSize]; - * binarySerializer.serializeNativeObject(object, stream, 0); + * #serializeNativeObject(Object, byte[], int, Object...)}. So if we call: byte[] + * stream = new byte[serializedSize]; binarySerializer.serializeNativeObject(object, stream, 0); * walChanges.setBinaryValue(buffer, stream, 10); * Then following assert should pass - * assert object.equals(binarySerializer.deserializeFromByteBufferObject(buffer, walChanges, 10)); + * assert object.equals(binarySerializer.deserializeFromByteBufferObject(buffer, walChanges, + * 10)); * * + *

ByteBuffer position should NOT be changed during call of this method. + * * @param buffer Buffer which will contain serialized changes. * @param walChanges Changes are done during atomic operation. * @param offset Offset of binary presentation of object inside of byte buffer/atomic operations @@ -191,6 +221,8 @@ public interface OBinarySerializer { * Result of call should be the same as result of call of {@link #getObjectSize(Object, * Object...)} on deserialized object. * + *

ByteBuffer position should NOT be changed during call of this method. + * * @param buffer Buffer which will contain serialized changes. * @param walChanges Changes are done during atomic operation. * @param offset Offset of binary presentation of object inside of byte buffer/atomic operations diff --git a/core/src/main/java/com/orientechnologies/common/serialization/types/OBinaryTypeSerializer.java b/core/src/main/java/com/orientechnologies/common/serialization/types/OBinaryTypeSerializer.java index d6550830e47..34d576e79c2 100644 --- a/core/src/main/java/com/orientechnologies/common/serialization/types/OBinaryTypeSerializer.java +++ b/core/src/main/java/com/orientechnologies/common/serialization/types/OBinaryTypeSerializer.java @@ -31,6 +31,7 @@ * @since 20.01.12 */ public class OBinaryTypeSerializer implements OBinarySerializer { + public static final OBinaryTypeSerializer INSTANCE = new OBinaryTypeSerializer(); public static final byte ID = 17; @@ -70,7 +71,7 @@ public int getObjectSizeNative(byte[] stream, int startPosition) { public void serializeNativeObject( byte[] object, byte[] stream, int startPosition, Object... hints) { final int len = object.length; - OIntegerSerializer.INSTANCE.serializeNative(len, stream, startPosition, hints); + OIntegerSerializer.INSTANCE.serializeNative(len, stream, startPosition); System.arraycopy(object, 0, stream, startPosition + OIntegerSerializer.INT_SIZE, len); } @@ -116,12 +117,28 @@ public byte[] deserializeFromByteBufferObject(ByteBuffer buffer) { return result; } + @Override + public byte[] deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + final int len = buffer.getInt(offset); + offset += Integer.BYTES; + + final byte[] result = new byte[len]; + buffer.get(offset, result); + + return result; + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return buffer.getInt() + OIntegerSerializer.INT_SIZE; } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return buffer.getInt(offset) + OIntegerSerializer.INT_SIZE; + } + /** {@inheritDoc} */ @Override public byte[] deserializeFromByteBufferObject( diff --git a/core/src/main/java/com/orientechnologies/common/serialization/types/OBooleanSerializer.java b/core/src/main/java/com/orientechnologies/common/serialization/types/OBooleanSerializer.java index 95e7f27230d..7c45fbd89f5 100644 --- a/core/src/main/java/com/orientechnologies/common/serialization/types/OBooleanSerializer.java +++ b/core/src/main/java/com/orientechnologies/common/serialization/types/OBooleanSerializer.java @@ -30,6 +30,7 @@ * @since 18.01.12 */ public class OBooleanSerializer implements OBinarySerializer { + /** size of boolean value in bytes */ public static final int BOOLEAN_SIZE = 1; @@ -75,8 +76,7 @@ public void serializeNativeObject( serialize(object, stream, startPosition); } - public void serializeNative( - final boolean object, final byte[] stream, final int startPosition, final Object... hints) { + public void serializeNative(final boolean object, final byte[] stream, final int startPosition) { serializeLiteral(object, stream, startPosition); } @@ -105,7 +105,7 @@ public Boolean preprocess(final Boolean value, final Object... hints) { /** {@inheritDoc} */ @Override public void serializeInByteBufferObject(Boolean object, ByteBuffer buffer, Object... hints) { - buffer.put(object.booleanValue() ? (byte) 1 : (byte) 0); + buffer.put(object ? (byte) 1 : (byte) 0); } /** {@inheritDoc} */ @@ -114,12 +114,22 @@ public Boolean deserializeFromByteBufferObject(ByteBuffer buffer) { return buffer.get() > 0; } + @Override + public Boolean deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + return buffer.get(offset) > 0; + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return BOOLEAN_SIZE; } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return BOOLEAN_SIZE; + } + /** {@inheritDoc} */ @Override public Boolean deserializeFromByteBufferObject( diff --git a/core/src/main/java/com/orientechnologies/common/serialization/types/OByteSerializer.java b/core/src/main/java/com/orientechnologies/common/serialization/types/OByteSerializer.java index 104c288d8cb..a88bd448a32 100644 --- a/core/src/main/java/com/orientechnologies/common/serialization/types/OByteSerializer.java +++ b/core/src/main/java/com/orientechnologies/common/serialization/types/OByteSerializer.java @@ -42,7 +42,7 @@ public int getObjectSize(Byte object, Object... hints) { public void serialize( final Byte object, final byte[] stream, final int startPosition, final Object... hints) { - stream[startPosition] = object.byteValue(); + stream[startPosition] = object; } public void serializeLiteral(final byte value, final byte[] stream, final int startPosition) { @@ -75,14 +75,10 @@ public void serializeNativeObject( serialize(object, stream, startPosition); } - public void serializeNative(byte object, byte[] stream, int startPosition, Object... hints) { + public void serializeNative(byte object, byte[] stream, int startPosition) { serializeLiteral(object, stream, startPosition); } - public void serializeRawBytes(final byte[] bytesToWrite, final byte[] stream, int startPosition) { - System.arraycopy(bytesToWrite, 0, stream, startPosition, bytesToWrite.length); - } - @Override public Byte deserializeNativeObject(final byte[] stream, final int startPosition) { return stream[startPosition]; @@ -117,12 +113,22 @@ public Byte deserializeFromByteBufferObject(ByteBuffer buffer) { return buffer.get(); } + @Override + public Byte deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + return buffer.get(offset); + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return BYTE_SIZE; } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return BYTE_SIZE; + } + /** {@inheritDoc} */ @Override public Byte deserializeFromByteBufferObject( diff --git a/core/src/main/java/com/orientechnologies/common/serialization/types/OCharSerializer.java b/core/src/main/java/com/orientechnologies/common/serialization/types/OCharSerializer.java index eb60557fcbc..59db5b9d13a 100644 --- a/core/src/main/java/com/orientechnologies/common/serialization/types/OCharSerializer.java +++ b/core/src/main/java/com/orientechnologies/common/serialization/types/OCharSerializer.java @@ -44,7 +44,7 @@ public int getObjectSize(final Character object, Object... hints) { public void serialize( final Character object, final byte[] stream, final int startPosition, final Object... hints) { - serializeLiteral(object.charValue(), stream, startPosition); + serializeLiteral(object, stream, startPosition); } public void serializeLiteral(final char value, final byte[] stream, final int startPosition) { @@ -87,8 +87,7 @@ public Character deserializeNativeObject(final byte[] stream, final int startPos return BINARY_CONVERTER.getChar(stream, startPosition, ByteOrder.nativeOrder()); } - public void serializeNative( - final char object, final byte[] stream, final int startPosition, final Object... hints) { + public void serializeNative(final char object, final byte[] stream, final int startPosition) { checkBoundaries(stream, startPosition); BINARY_CONVERTER.putChar(stream, startPosition, object, ByteOrder.nativeOrder()); @@ -125,12 +124,22 @@ public Character deserializeFromByteBufferObject(ByteBuffer buffer) { return buffer.getChar(); } + @Override + public Character deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + return buffer.getChar(offset); + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return CHAR_SIZE; } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return CHAR_SIZE; + } + /** {@inheritDoc} */ @Override public Character deserializeFromByteBufferObject( diff --git a/core/src/main/java/com/orientechnologies/common/serialization/types/ODateSerializer.java b/core/src/main/java/com/orientechnologies/common/serialization/types/ODateSerializer.java index 8b0175bbbcf..00ecaac3be9 100644 --- a/core/src/main/java/com/orientechnologies/common/serialization/types/ODateSerializer.java +++ b/core/src/main/java/com/orientechnologies/common/serialization/types/ODateSerializer.java @@ -128,12 +128,23 @@ public Date deserializeFromByteBufferObject(ByteBuffer buffer) { return dateTimeSerializer.deserializeFromByteBufferObject(buffer); } + @Override + public Date deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + final ODateTimeSerializer dateTimeSerializer = ODateTimeSerializer.INSTANCE; + return dateTimeSerializer.deserializeFromByteBufferObject(offset, buffer); + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return OLongSerializer.LONG_SIZE; } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return OLongSerializer.LONG_SIZE; + } + /** {@inheritDoc} */ @Override public Date deserializeFromByteBufferObject( diff --git a/core/src/main/java/com/orientechnologies/common/serialization/types/ODateTimeSerializer.java b/core/src/main/java/com/orientechnologies/common/serialization/types/ODateTimeSerializer.java index 26379d3db41..562c1be04e6 100644 --- a/core/src/main/java/com/orientechnologies/common/serialization/types/ODateTimeSerializer.java +++ b/core/src/main/java/com/orientechnologies/common/serialization/types/ODateTimeSerializer.java @@ -32,6 +32,7 @@ * @since 20.01.12 */ public class ODateTimeSerializer implements OBinarySerializer { + public static final byte ID = 5; public static final ODateTimeSerializer INSTANCE = new ODateTimeSerializer(); @@ -107,12 +108,25 @@ public Date deserializeFromByteBufferObject(ByteBuffer buffer) { return calendar.getTime(); } + @Override + public Date deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + final Calendar calendar = Calendar.getInstance(); + calendar.setTimeInMillis(buffer.getLong(offset)); + + return calendar.getTime(); + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return OLongSerializer.LONG_SIZE; } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return OLongSerializer.LONG_SIZE; + } + /** {@inheritDoc} */ @Override public Date deserializeFromByteBufferObject( diff --git a/core/src/main/java/com/orientechnologies/common/serialization/types/ODecimalSerializer.java b/core/src/main/java/com/orientechnologies/common/serialization/types/ODecimalSerializer.java index 07360dcd4a8..6938316de82 100644 --- a/core/src/main/java/com/orientechnologies/common/serialization/types/ODecimalSerializer.java +++ b/core/src/main/java/com/orientechnologies/common/serialization/types/ODecimalSerializer.java @@ -32,6 +32,7 @@ * @since 03.04.12 */ public class ODecimalSerializer implements OBinarySerializer { + public static final ODecimalSerializer INSTANCE = new ODecimalSerializer(); public static final byte ID = 18; @@ -41,11 +42,9 @@ public int getObjectSize(BigDecimal object, Object... hints) { } public int getObjectSize(byte[] stream, int startPosition) { - final int size = - OIntegerSerializer.INT_SIZE - + OBinaryTypeSerializer.INSTANCE.getObjectSize( - stream, startPosition + OIntegerSerializer.INT_SIZE); - return size; + return OIntegerSerializer.INT_SIZE + + OBinaryTypeSerializer.INSTANCE.getObjectSize( + stream, startPosition + OIntegerSerializer.INT_SIZE); } public void serialize(BigDecimal object, byte[] stream, int startPosition, Object... hints) { @@ -69,11 +68,9 @@ public byte getId() { } public int getObjectSizeNative(final byte[] stream, final int startPosition) { - final int size = - OIntegerSerializer.INT_SIZE - + OBinaryTypeSerializer.INSTANCE.getObjectSizeNative( - stream, startPosition + OIntegerSerializer.INT_SIZE); - return size; + return OIntegerSerializer.INT_SIZE + + OBinaryTypeSerializer.INSTANCE.getObjectSizeNative( + stream, startPosition + OIntegerSerializer.INT_SIZE); } @Override @@ -127,6 +124,17 @@ public BigDecimal deserializeFromByteBufferObject(ByteBuffer buffer) { return new BigDecimal(new BigInteger(unscaledValue), scale); } + @Override + public BigDecimal deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + final int scale = buffer.getInt(offset); + offset += Integer.BYTES; + + final byte[] unscaledValue = + OBinaryTypeSerializer.INSTANCE.deserializeFromByteBufferObject(offset, buffer); + + return new BigDecimal(new BigInteger(unscaledValue), scale); + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { @@ -135,6 +143,12 @@ public int getObjectSizeInByteBuffer(ByteBuffer buffer) { + OBinaryTypeSerializer.INSTANCE.getObjectSizeInByteBuffer(buffer); } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return Integer.BYTES + + OBinaryTypeSerializer.INSTANCE.getObjectSizeInByteBuffer(offset + Integer.BYTES, buffer); + } + /** {@inheritDoc} */ @Override public BigDecimal deserializeFromByteBufferObject( diff --git a/core/src/main/java/com/orientechnologies/common/serialization/types/ODoubleSerializer.java b/core/src/main/java/com/orientechnologies/common/serialization/types/ODoubleSerializer.java index a55b8a79962..89b2d1c49aa 100644 --- a/core/src/main/java/com/orientechnologies/common/serialization/types/ODoubleSerializer.java +++ b/core/src/main/java/com/orientechnologies/common/serialization/types/ODoubleSerializer.java @@ -34,6 +34,7 @@ */ public class ODoubleSerializer implements OBinarySerializer { public static final byte ID = 6; + /** size of double value in bytes */ public static final int DOUBLE_SIZE = 8; @@ -67,8 +68,7 @@ public int getObjectSizeNative(final byte[] stream, final int startPosition) { return DOUBLE_SIZE; } - public void serializeNative( - final double object, final byte[] stream, final int startPosition, final Object... hints) { + public void serializeNative(final double object, final byte[] stream, final int startPosition) { checkBoundaries(stream, startPosition); CONVERTER.putLong( @@ -124,12 +124,22 @@ public Double deserializeFromByteBufferObject(ByteBuffer buffer) { return Double.longBitsToDouble(buffer.getLong()); } + @Override + public Double deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + return Double.longBitsToDouble(buffer.getLong(offset)); + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return DOUBLE_SIZE; } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return DOUBLE_SIZE; + } + /** {@inheritDoc} */ @Override public Double deserializeFromByteBufferObject( diff --git a/core/src/main/java/com/orientechnologies/common/serialization/types/OFloatSerializer.java b/core/src/main/java/com/orientechnologies/common/serialization/types/OFloatSerializer.java index 29eaed7e89d..d3e0f861bf8 100644 --- a/core/src/main/java/com/orientechnologies/common/serialization/types/OFloatSerializer.java +++ b/core/src/main/java/com/orientechnologies/common/serialization/types/OFloatSerializer.java @@ -33,7 +33,9 @@ * @since 18.01.12 */ public class OFloatSerializer implements OBinarySerializer { + public static final byte ID = 7; + /** size of float value in bytes */ public static final int FLOAT_SIZE = 4; @@ -81,8 +83,7 @@ public Float deserializeNativeObject(byte[] stream, int startPosition) { return Float.intBitsToFloat(CONVERTER.getInt(stream, startPosition, ByteOrder.nativeOrder())); } - public void serializeNative( - final float object, final byte[] stream, final int startPosition, final Object... hints) { + public void serializeNative(final float object, final byte[] stream, final int startPosition) { checkBoundaries(stream, startPosition); CONVERTER.putInt(stream, startPosition, Float.floatToIntBits(object), ByteOrder.nativeOrder()); @@ -119,6 +120,11 @@ public Float deserializeFromByteBufferObject(ByteBuffer buffer) { return Float.intBitsToFloat(buffer.getInt()); } + @Override + public Float deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + return Float.intBitsToFloat(buffer.getInt(offset)); + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { @@ -138,6 +144,11 @@ public int getObjectSizeInByteBuffer(ByteBuffer buffer, OWALChanges walChanges, return FLOAT_SIZE; } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return FLOAT_SIZE; + } + private static void checkBoundaries(byte[] stream, int startPosition) { if (startPosition + FLOAT_SIZE > stream.length) { throw new IllegalStateException( diff --git a/core/src/main/java/com/orientechnologies/common/serialization/types/OIntegerSerializer.java b/core/src/main/java/com/orientechnologies/common/serialization/types/OIntegerSerializer.java index 106750e88ae..96884227665 100644 --- a/core/src/main/java/com/orientechnologies/common/serialization/types/OIntegerSerializer.java +++ b/core/src/main/java/com/orientechnologies/common/serialization/types/OIntegerSerializer.java @@ -33,7 +33,9 @@ * @since 17.01.12 */ public class OIntegerSerializer implements OBinarySerializer { + public static final byte ID = 8; + /** size of int value in bytes */ public static final int INT_SIZE = 4; @@ -46,14 +48,14 @@ public int getObjectSize(Integer object, Object... hints) { public void serialize( final Integer object, final byte[] stream, final int startPosition, final Object... hints) { - serializeLiteral(object.intValue(), stream, startPosition); + serializeLiteral(object, stream, startPosition); } public void serializeLiteral(final int value, final byte[] stream, final int startPosition) { stream[startPosition] = (byte) ((value >>> 24) & 0xFF); stream[startPosition + 1] = (byte) ((value >>> 16) & 0xFF); stream[startPosition + 2] = (byte) ((value >>> 8) & 0xFF); - stream[startPosition + 3] = (byte) ((value >>> 0) & 0xFF); + stream[startPosition + 3] = (byte) ((value) & 0xFF); } public Integer deserialize(final byte[] stream, final int startPosition) { @@ -94,7 +96,7 @@ public Integer deserializeNativeObject(final byte[] stream, final int startPosit return CONVERTER.getInt(stream, startPosition, ByteOrder.nativeOrder()); } - public void serializeNative(int object, byte[] stream, int startPosition, Object... hints) { + public void serializeNative(int object, byte[] stream, int startPosition) { checkBoundaries(stream, startPosition); CONVERTER.putInt(stream, startPosition, object, ByteOrder.nativeOrder()); @@ -131,12 +133,22 @@ public Integer deserializeFromByteBufferObject(ByteBuffer buffer) { return buffer.getInt(); } + @Override + public Integer deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + return buffer.getInt(offset); + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return INT_SIZE; } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return INT_SIZE; + } + /** {@inheritDoc} */ @Override public Integer deserializeFromByteBufferObject( diff --git a/core/src/main/java/com/orientechnologies/common/serialization/types/OLongSerializer.java b/core/src/main/java/com/orientechnologies/common/serialization/types/OLongSerializer.java index 5e910dce721..743fe86ca24 100644 --- a/core/src/main/java/com/orientechnologies/common/serialization/types/OLongSerializer.java +++ b/core/src/main/java/com/orientechnologies/common/serialization/types/OLongSerializer.java @@ -33,7 +33,9 @@ * @since 18.01.12 */ public class OLongSerializer implements OBinarySerializer { + public static final byte ID = 10; + /** size of long value in bytes */ public static final int LONG_SIZE = 8; @@ -46,7 +48,7 @@ public int getObjectSize(final Long object, final Object... hints) { public void serialize( final Long object, final byte[] stream, final int startPosition, final Object... hints) { - serializeLiteral(object.longValue(), stream, startPosition); + serializeLiteral(object, stream, startPosition); } public void serializeLiteral(final long value, final byte[] stream, final int startPosition) { @@ -57,7 +59,7 @@ public void serializeLiteral(final long value, final byte[] stream, final int st stream[startPosition + 4] = (byte) ((value >>> 24) & 0xFF); stream[startPosition + 5] = (byte) ((value >>> 16) & 0xFF); stream[startPosition + 6] = (byte) ((value >>> 8) & 0xFF); - stream[startPosition + 7] = (byte) ((value >>> 0) & 0xFF); + stream[startPosition + 7] = (byte) ((value) & 0xFF); } public Long deserialize(final byte[] stream, final int startPosition) { @@ -102,8 +104,7 @@ public Long deserializeNativeObject(final byte[] stream, final int startPosition return CONVERTER.getLong(stream, startPosition, ByteOrder.nativeOrder()); } - public void serializeNative( - final long object, final byte[] stream, final int startPosition, final Object... hints) { + public void serializeNative(final long object, final byte[] stream, final int startPosition) { checkBoundaries(stream, startPosition); CONVERTER.putLong(stream, startPosition, object, ByteOrder.nativeOrder()); @@ -140,12 +141,22 @@ public Long deserializeFromByteBufferObject(ByteBuffer buffer) { return buffer.getLong(); } + @Override + public Long deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + return buffer.getLong(offset); + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return LONG_SIZE; } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return LONG_SIZE; + } + /** {@inheritDoc} */ @Override public Long deserializeFromByteBufferObject( diff --git a/core/src/main/java/com/orientechnologies/common/serialization/types/ONullSerializer.java b/core/src/main/java/com/orientechnologies/common/serialization/types/ONullSerializer.java index b896ea687e2..9d3df5d3292 100644 --- a/core/src/main/java/com/orientechnologies/common/serialization/types/ONullSerializer.java +++ b/core/src/main/java/com/orientechnologies/common/serialization/types/ONullSerializer.java @@ -89,12 +89,23 @@ public Object deserializeFromByteBufferObject(ByteBuffer buffer) { return null; } + /** {@inheritDoc} */ + @Override + public Object deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + return null; + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return 0; } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return 0; + } + /** {@inheritDoc} */ @Override public Object deserializeFromByteBufferObject( diff --git a/core/src/main/java/com/orientechnologies/common/serialization/types/OShortSerializer.java b/core/src/main/java/com/orientechnologies/common/serialization/types/OShortSerializer.java index ad0be4f3dab..af62b16e656 100644 --- a/core/src/main/java/com/orientechnologies/common/serialization/types/OShortSerializer.java +++ b/core/src/main/java/com/orientechnologies/common/serialization/types/OShortSerializer.java @@ -34,6 +34,7 @@ */ public class OShortSerializer implements OBinarySerializer { public static final byte ID = 12; + /** size of short value in bytes */ public static final int SHORT_SIZE = 2; @@ -46,12 +47,12 @@ public int getObjectSize(Short object, Object... hints) { public void serialize( final Short object, final byte[] stream, final int startPosition, final Object... hints) { - serializeLiteral(object.shortValue(), stream, startPosition); + serializeLiteral(object, stream, startPosition); } public void serializeLiteral(final short value, final byte[] stream, final int startPosition) { stream[startPosition] = (byte) ((value >>> 8) & 0xFF); - stream[startPosition + 1] = (byte) ((value >>> 0) & 0xFF); + stream[startPosition + 1] = (byte) ((value) & 0xFF); } public Short deserialize(final byte[] stream, final int startPosition) { @@ -89,8 +90,7 @@ public Short deserializeNativeObject(byte[] stream, int startPosition) { return CONVERTER.getShort(stream, startPosition, ByteOrder.nativeOrder()); } - public void serializeNative( - final short object, final byte[] stream, final int startPosition, final Object... hints) { + public void serializeNative(final short object, final byte[] stream, final int startPosition) { checkBoundaries(stream, startPosition); CONVERTER.putShort(stream, startPosition, object, ByteOrder.nativeOrder()); @@ -127,12 +127,22 @@ public Short deserializeFromByteBufferObject(ByteBuffer buffer) { return buffer.getShort(); } + @Override + public Short deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + return buffer.getShort(offset); + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return SHORT_SIZE; } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return SHORT_SIZE; + } + /** {@inheritDoc} */ @Override public Short deserializeFromByteBufferObject( diff --git a/core/src/main/java/com/orientechnologies/common/serialization/types/OStringSerializer.java b/core/src/main/java/com/orientechnologies/common/serialization/types/OStringSerializer.java index c63cbe4bcc3..8d91c8eb43a 100644 --- a/core/src/main/java/com/orientechnologies/common/serialization/types/OStringSerializer.java +++ b/core/src/main/java/com/orientechnologies/common/serialization/types/OStringSerializer.java @@ -30,6 +30,7 @@ * @since 18.01.12 */ public class OStringSerializer implements OBinarySerializer { + public static final OStringSerializer INSTANCE = new OStringSerializer(); public static final byte ID = 13; @@ -171,12 +172,32 @@ public String deserializeFromByteBufferObject(ByteBuffer buffer) { return new String(chars); } + @Override + public String deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + int len = buffer.getInt(offset); + offset += OIntegerSerializer.INT_SIZE; + + final char[] chars = new char[len]; + final byte[] binaryData = new byte[2 * len]; + buffer.get(offset, binaryData); + + for (int i = 0; i < len; i++) + chars[i] = (char) ((0xFF & binaryData[i << 1]) | ((0xFF & binaryData[(i << 1) + 1]) << 8)); + + return new String(chars); + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return buffer.getInt() * 2 + OIntegerSerializer.INT_SIZE; } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return buffer.getInt(offset) * 2 + OIntegerSerializer.INT_SIZE; + } + /** {@inheritDoc} */ @Override public String deserializeFromByteBufferObject( diff --git a/core/src/main/java/com/orientechnologies/common/serialization/types/OUTF8Serializer.java b/core/src/main/java/com/orientechnologies/common/serialization/types/OUTF8Serializer.java index abb0b20e29e..b0686c2a068 100755 --- a/core/src/main/java/com/orientechnologies/common/serialization/types/OUTF8Serializer.java +++ b/core/src/main/java/com/orientechnologies/common/serialization/types/OUTF8Serializer.java @@ -2,7 +2,6 @@ import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges; import java.nio.ByteBuffer; -import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; public class OUTF8Serializer implements OBinarySerializer { @@ -91,7 +90,7 @@ public String preprocess(String value, Object... hints) { @Override public void serializeInByteBufferObject(String object, ByteBuffer buffer, Object... hints) { - final byte[] encoded = object.getBytes(Charset.forName("UTF-8")); + final byte[] encoded = object.getBytes(StandardCharsets.UTF_8); buffer.putShort((short) encoded.length); buffer.put(encoded); @@ -106,11 +105,26 @@ public String deserializeFromByteBufferObject(ByteBuffer buffer) { return new String(encoded, StandardCharsets.UTF_8); } + @Override + public String deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + final int encodedSize = buffer.getShort(offset) & INT_MASK; + offset += Short.BYTES; + + final byte[] encoded = new byte[encodedSize]; + buffer.get(offset, encoded); + return new String(encoded, StandardCharsets.UTF_8); + } + @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return (buffer.getShort() & INT_MASK) + OShortSerializer.SHORT_SIZE; } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return (buffer.getShort(offset) & INT_MASK) + OShortSerializer.SHORT_SIZE; + } + @Override public String deserializeFromByteBufferObject( ByteBuffer buffer, OWALChanges walChanges, int offset) { diff --git a/core/src/main/java/com/orientechnologies/common/serialization/types/OUUIDSerializer.java b/core/src/main/java/com/orientechnologies/common/serialization/types/OUUIDSerializer.java index d862a9758e6..8b43df548bb 100644 --- a/core/src/main/java/com/orientechnologies/common/serialization/types/OUUIDSerializer.java +++ b/core/src/main/java/com/orientechnologies/common/serialization/types/OUUIDSerializer.java @@ -24,8 +24,11 @@ import java.nio.ByteBuffer; import java.util.UUID; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public class OUUIDSerializer implements OBinarySerializer { + public static final OUUIDSerializer INSTANCE = new OUUIDSerializer(); public static final int UUID_SIZE = 2 * OLongSerializer.LONG_SIZE; @@ -77,9 +80,9 @@ public int getFixedLength() { public void serializeNativeObject( final UUID object, final byte[] stream, final int startPosition, final Object... hints) { OLongSerializer.INSTANCE.serializeNative( - object.getMostSignificantBits(), stream, startPosition, hints); + object.getMostSignificantBits(), stream, startPosition); OLongSerializer.INSTANCE.serializeNative( - object.getLeastSignificantBits(), stream, startPosition + OLongSerializer.LONG_SIZE, hints); + object.getLeastSignificantBits(), stream, startPosition + OLongSerializer.LONG_SIZE); } @Override @@ -117,12 +120,27 @@ public UUID deserializeFromByteBufferObject(ByteBuffer buffer) { return new UUID(mostSignificantBits, leastSignificantBits); } + @Override + public UUID deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + final long mostSignificantBits = buffer.getLong(offset); + offset += Long.BYTES; + + final long leastSignificantBits = buffer.getLong(offset); + + return new UUID(mostSignificantBits, leastSignificantBits); + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return UUID_SIZE; } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return UUID_SIZE; + } + /** {@inheritDoc} */ @Override public UUID deserializeFromByteBufferObject( diff --git a/core/src/main/java/com/orientechnologies/common/util/OMemory.java b/core/src/main/java/com/orientechnologies/common/util/OMemory.java index b46b0c4598d..b621a8a72cb 100755 --- a/core/src/main/java/com/orientechnologies/common/util/OMemory.java +++ b/core/src/main/java/com/orientechnologies/common/util/OMemory.java @@ -70,9 +70,10 @@ public static void checkCacheMemoryConfiguration() { + " bytes) is larger than the available physical memory size " + "(" + physicalMemory.memoryLimit - + " bytes). That may cause out of memory errors, please tune the configuration up. Use the " - + "-Xmx JVM option to lower the JVM maximum heap memory size or storage.diskCache.bufferSize OrientDB option to " - + "lower memory requirements of the cache."); + + " bytes). That may cause out of memory errors, please tune the configuration" + + " up. Use the -Xmx JVM option to lower the JVM maximum heap memory size or" + + " storage.diskCache.bufferSize OrientDB option to lower memory requirements of" + + " the cache."); } /** diff --git a/core/src/main/java/com/orientechnologies/orient/core/OConstants.java b/core/src/main/java/com/orientechnologies/orient/core/OConstants.java index 0ffae739f5e..25952dffcc4 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/OConstants.java +++ b/core/src/main/java/com/orientechnologies/orient/core/OConstants.java @@ -22,7 +22,9 @@ public class OConstants { } } - /** @return Major part of OrientDB version */ + /** + * @return Major part of OrientDB version + */ public static int getVersionMajor() { final String[] versions = properties.getProperty("version").split("\\."); if (versions.length == 0) { @@ -41,7 +43,9 @@ public static int getVersionMajor() { } } - /** @return Minor part of OrientDB version */ + /** + * @return Minor part of OrientDB version + */ public static int getVersionMinor() { final String[] versions = properties.getProperty("version").split("\\."); if (versions.length < 2) { @@ -61,7 +65,9 @@ public static int getVersionMinor() { } } - /** @return Hotfix part of OrientDB version */ + /** + * @return Hotfix part of OrientDB version + */ @SuppressWarnings("unused") public static int getVersionHotfix() { final String[] versions = properties.getProperty("version").split("\\."); @@ -86,7 +92,9 @@ public static int getVersionHotfix() { } } - /** @return Returns only current version without build number and etc. */ + /** + * @return Returns only current version without build number and etc. + */ public static String getRawVersion() { return properties.getProperty("version"); } @@ -106,7 +114,9 @@ public static boolean isSnapshot() { return properties.getProperty("version").endsWith("SNAPSHOT"); } - /** @return the build number if any. */ + /** + * @return the build number if any. + */ public static String getBuildNumber() { return properties.getProperty("revision"); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/cache/OAbstractMapCache.java b/core/src/main/java/com/orientechnologies/orient/core/cache/OAbstractMapCache.java index e1e69fa317c..e670eb4a4ca 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/cache/OAbstractMapCache.java +++ b/core/src/main/java/com/orientechnologies/orient/core/cache/OAbstractMapCache.java @@ -25,7 +25,9 @@ import java.util.Collection; import java.util.Map; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public abstract class OAbstractMapCache> implements ORecordCache { protected T cache; diff --git a/core/src/main/java/com/orientechnologies/orient/core/cache/ORecordCacheWeakRefs.java b/core/src/main/java/com/orientechnologies/orient/core/cache/ORecordCacheWeakRefs.java index 4490876d9dc..e15b7649c9d 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/cache/ORecordCacheWeakRefs.java +++ b/core/src/main/java/com/orientechnologies/orient/core/cache/ORecordCacheWeakRefs.java @@ -25,7 +25,9 @@ import java.lang.ref.WeakReference; import java.util.WeakHashMap; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public class ORecordCacheWeakRefs extends OAbstractMapCache>> implements ORecordCache { diff --git a/core/src/main/java/com/orientechnologies/orient/core/collate/OCollateFactory.java b/core/src/main/java/com/orientechnologies/orient/core/collate/OCollateFactory.java index 031334bdb5f..f0b6304714a 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/collate/OCollateFactory.java +++ b/core/src/main/java/com/orientechnologies/orient/core/collate/OCollateFactory.java @@ -28,7 +28,9 @@ */ public interface OCollateFactory { - /** @return Set of supported collate names of this factory */ + /** + * @return Set of supported collate names of this factory + */ Set getNames(); /** diff --git a/core/src/main/java/com/orientechnologies/orient/core/collate/ODefaultCollateFactory.java b/core/src/main/java/com/orientechnologies/orient/core/collate/ODefaultCollateFactory.java index 015b89f92c2..6aff7c64975 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/collate/ODefaultCollateFactory.java +++ b/core/src/main/java/com/orientechnologies/orient/core/collate/ODefaultCollateFactory.java @@ -37,7 +37,9 @@ public class ODefaultCollateFactory implements OCollateFactory { register(new OCaseInsensitiveCollate()); } - /** @return Set of supported collate names of this factory */ + /** + * @return Set of supported collate names of this factory + */ @Override public Set getNames() { return COLLATES.keySet(); diff --git a/core/src/main/java/com/orientechnologies/orient/core/command/traverse/OTraversePath.java b/core/src/main/java/com/orientechnologies/orient/core/command/traverse/OTraversePath.java index 83f65fc275c..fb94be34b11 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/command/traverse/OTraversePath.java +++ b/core/src/main/java/com/orientechnologies/orient/core/command/traverse/OTraversePath.java @@ -23,7 +23,9 @@ import com.orientechnologies.orient.core.db.record.OIdentifiable; import java.util.ArrayDeque; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public class OTraversePath { private static final OTraversePath EMPTY_PATH = new OTraversePath(new FirstPathItem()); diff --git a/core/src/main/java/com/orientechnologies/orient/core/compression/impl/OZIPCompression.java b/core/src/main/java/com/orientechnologies/orient/core/compression/impl/OZIPCompression.java index e1eea6cffd7..5acc897aeed 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/compression/impl/OZIPCompression.java +++ b/core/src/main/java/com/orientechnologies/orient/core/compression/impl/OZIPCompression.java @@ -28,7 +28,9 @@ import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; -/** @author Luca Garulli */ +/** + * @author Luca Garulli + */ public abstract class OZIPCompression extends OAbstractCompression { @Override public byte[] compress(final byte[] content, final int offset, final int length) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/config/OGlobalConfiguration.java b/core/src/main/java/com/orientechnologies/orient/core/config/OGlobalConfiguration.java index 188028bc1cd..69a849f99c5 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/config/OGlobalConfiguration.java +++ b/core/src/main/java/com/orientechnologies/orient/core/config/OGlobalConfiguration.java @@ -17,6 +17,7 @@ * * For more information: http://orientdb.com * */ + package com.orientechnologies.orient.core.config; import com.orientechnologies.common.io.OFileUtils; @@ -25,12 +26,8 @@ import com.orientechnologies.common.util.OApi; import com.orientechnologies.orient.core.OConstants; import com.orientechnologies.orient.core.Orient; -import com.orientechnologies.orient.core.cache.ORecordCacheWeakRefs; -import com.orientechnologies.orient.core.engine.local.OEngineLocalPaginated; import com.orientechnologies.orient.core.index.OIndexDefinition; -import com.orientechnologies.orient.core.serialization.serializer.record.binary.ORecordSerializerBinary; import com.orientechnologies.orient.core.storage.OChecksumMode; -import com.orientechnologies.orient.core.storage.cluster.OPaginatedCluster; import java.io.PrintStream; import java.util.Locale; import java.util.Map; @@ -55,7 +52,8 @@ public enum OGlobalConfiguration { // ENVIRONMENT @Deprecated ENVIRONMENT_CONCURRENT( "environment.concurrent", - "Specifies if running in multi-thread environment. Setting this to false turns off the internal lock management", + "Specifies if running in multi-thread environment. Setting this to false turns off the" + + " internal lock management", Boolean.class, Boolean.TRUE), @@ -112,34 +110,38 @@ public enum OGlobalConfiguration { // ENVIRONMENT MEMORY_LEFT_TO_OS( "memory.leftToOS", - "Amount of free memory which should be left unallocated in case of OrientDB is started outside of container. " - + "Value can be set as % of total memory provided to OrientDB or as absolute value in bytes, kilobytes, megabytes or gigabytes. " - + "If you set value as 10% it means that 10% of memory will not be allocated by OrientDB and will be left to use by the rest of " - + "applications, if 2g value is provided it means that 2 gigabytes of memory will be left to use by the rest of applications. " - + "Default value is 2g", + "Amount of free memory which should be left unallocated in case of OrientDB is started" + + " outside of container. Value can be set as % of total memory provided to OrientDB or" + + " as absolute value in bytes, kilobytes, megabytes or gigabytes. If you set value as" + + " 10% it means that 10% of memory will not be allocated by OrientDB and will be left to" + + " use by the rest of applications, if 2g value is provided it means that 2 gigabytes of" + + " memory will be left to use by the rest of applications. Default value is 2g", String.class, "2g"), MEMORY_LEFT_TO_CONTAINER( "memory.leftToContainer", - "Amount of free memory which should be left unallocated in case of OrientDB is started inside of container. " - + "Value can be set as % of total memory provided to OrientDB or as absolute value in bytes, kilobytes, megabytes or gigabytes. " - + "If you set value as 10% it means that 10% of memory will not be allocated by OrientDB and will be left to use by the rest of " - + "applications, if 2g value is provided it means that 2 gigabytes of memory will be left to use by the rest of applications. " - + "Default value is 256m", + "Amount of free memory which should be left unallocated in case of OrientDB is started inside" + + " of container. Value can be set as % of total memory provided to OrientDB or as" + + " absolute value in bytes, kilobytes, megabytes or gigabytes. If you set value as 10%" + + " it means that 10% of memory will not be allocated by OrientDB and will be left to use" + + " by the rest of applications, if 2g value is provided it means that 2 gigabytes of" + + " memory will be left to use by the rest of applications. Default value is 256m", String.class, "256m"), DIRECT_MEMORY_SAFE_MODE( "memory.directMemory.safeMode", - "Indicates whether to perform a range check before each direct memory update. It is true by default, " - + "but usually it can be safely set to false. It should only be to true after dramatic changes have been made in the storage structures", + "Indicates whether to perform a range check before each direct memory update. It is true by" + + " default, but usually it can be safely set to false. It should only be to true after" + + " dramatic changes have been made in the storage structures", Boolean.class, true), DIRECT_MEMORY_POOL_LIMIT( "memory.pool.limit", - "Limit of the pages cached inside of direct memory pool to avoid frequent reallocation of memory in OS", + "Limit of the pages cached inside of direct memory pool to avoid frequent reallocation of" + + " memory in OS", Integer.class, Integer.MAX_VALUE), @@ -151,23 +153,27 @@ public enum OGlobalConfiguration { // ENVIRONMENT DIRECT_MEMORY_TRACK_MODE( "memory.directMemory.trackMode", - "Activates the direct memory pool [leak detector](Leak-Detector.md). This detector causes a large overhead and should be used for debugging " - + "purposes only. It's also a good idea to pass the " - + "-Djava.util.logging.manager=com.orientechnologies.common.log.ShutdownLogManager switch to the JVM, " - + "if you use this mode, this will enable the logging from JVM shutdown hooks.", + "Activates the direct memory pool [leak detector](Leak-Detector.md). This detector causes a" + + " large overhead and should be used for debugging purposes only. It's also a good idea" + + " to pass the" + + " -Djava.util.logging.manager=com.orientechnologies.common.log.ShutdownLogManager" + + " switch to the JVM, if you use this mode, this will enable the logging from JVM" + + " shutdown hooks.", Boolean.class, false), DIRECT_MEMORY_ONLY_ALIGNED_ACCESS( "memory.directMemory.onlyAlignedMemoryAccess", - "Some architectures do not allow unaligned memory access or may suffer from speed degradation. For such platforms, this flag should be set to true", + "Some architectures do not allow unaligned memory access or may suffer from speed" + + " degradation. For such platforms, this flag should be set to true", Boolean.class, true), @Deprecated JVM_GC_DELAY_FOR_OPTIMIZE( "jvm.gc.delayForOptimize", - "Minimal amount of time (in seconds), since the last System.gc(), when called after tree optimization", + "Minimal amount of time (in seconds), since the last System.gc(), when called after tree" + + " optimization", Long.class, 600), @@ -175,7 +181,8 @@ public enum OGlobalConfiguration { // ENVIRONMENT /** Limit of amount of files which may be open simultaneously */ OPEN_FILES_LIMIT( "storage.openFiles.limit", - "Limit of amount of files which may be open simultaneously, -1 (default) means automatic detection", + "Limit of amount of files which may be open simultaneously, -1 (default) means automatic" + + " detection", Integer.class, -1), @@ -185,25 +192,21 @@ public enum OGlobalConfiguration { // ENVIRONMENT */ COMPONENTS_LOCK_CACHE( "storage.componentsLock.cache", - "Amount of cached locks is used for component lock to avoid constant creation of new lock instances", + "Amount of cached locks is used for component lock to avoid constant creation of new lock" + + " instances", Integer.class, 10000), DISK_CACHE_PINNED_PAGES( "storage.diskCache.pinnedPages", - "Maximum amount of pinned pages which may be contained in cache," - + " if this percent is reached next pages will be left in unpinned state. You can not set value more than 50", + "Maximum amount of pinned pages which may be contained in cache, if this percent is reached" + + " next pages will be left in unpinned state. You can not set value more than 50", Integer.class, 20, false), DISK_CACHE_SIZE( - "storage.diskCache.bufferSize", - "Size of disk buffer in megabytes, disk size may be changed at runtime, " - + "but if does not enough to contain all pinned pages exception will be thrown", - Integer.class, - 4 * 1024, - new OCacheSizeChangeCallback()), + "storage.diskCache.bufferSize", "Size of disk buffer in megabytes", Integer.class, 4 * 1024), DISK_WRITE_CACHE_PART( "storage.diskCache.writeCachePart", @@ -245,15 +248,16 @@ public enum OGlobalConfiguration { // ENVIRONMENT DISK_WRITE_CACHE_FLUSH_WRITE_INACTIVITY_INTERVAL( "storage.diskCache.writeCacheFlushInactivityInterval", - "Interval between 2 writes to the disk cache," - + " if writes are done with an interval more than provided, all files will be fsynced before the next write," - + " which allows a data restore after a server crash (in ms)", + "Interval between 2 writes to the disk cache, if writes are done with an interval more than" + + " provided, all files will be fsynced before the next write, which allows a data" + + " restore after a server crash (in ms)", Long.class, 60 * 1000), DISK_WRITE_CACHE_FLUSH_LOCK_TIMEOUT( "storage.diskCache.writeCacheFlushLockTimeout", - "Maximum amount of time the write cache will wait before a page flushes (in ms, -1 to disable)", + "Maximum amount of time the write cache will wait before a page flushes (in ms, -1 to" + + " disable)", Integer.class, -1), @@ -264,8 +268,9 @@ public enum OGlobalConfiguration { // ENVIRONMENT */ DISC_CACHE_FREE_SPACE_CHECK_INTERVAL_IN_PAGES( "storage.diskCache.diskFreeSpaceCheckIntervalInPages", - "The interval (how many new pages should be added before free space will be checked), after which the storage periodically " - + "checks whether the amount of free disk space is enough to work in write mode", + "The interval (how many new pages should be added before free space will be checked), after" + + " which the storage periodically checks whether the amount of free disk space is enough" + + " to work in write mode", Integer.class, 2048), @@ -275,28 +280,31 @@ public enum OGlobalConfiguration { // ENVIRONMENT */ STORAGE_KEEP_DISK_CACHE_STATE( "storage.diskCache.keepState", - "Keep disk cache state between moment when storage is closed and moment when it is opened again. true by default", + "Keep disk cache state between moment when storage is closed and moment when it is opened" + + " again. true by default", Boolean.class, false), STORAGE_CHECKSUM_MODE( "storage.diskCache.checksumMode", - "Controls the per-page checksum storage and verification done by " - + "the file cache. Possible modes: 'off' – checksums are completely off; 'store' – checksums are calculated and stored " - + "on page flushes, no verification is done on page loads, stored checksums are verified only during user-initiated health " - + "checks; 'storeAndVerify' – checksums are calculated and stored on page flushes, verification is performed on " - + "each page load, errors are reported in the log; 'storeAndThrow' – same as `storeAndVerify` with addition of exceptions " - + "thrown on errors, this mode is useful for debugging and testing, but should be avoided in a production environment;" - + " 'storeAndSwitchReadOnlyMode' (default) - Same as 'storeAndVerify' with addition that storage will be switched in read only mode " - + "till it will not be repaired.", + "Controls the per-page checksum storage and verification done by the file cache. Possible" + + " modes: 'off' – checksums are completely off; 'store' – checksums are calculated and" + + " stored on page flushes, no verification is done on page loads, stored checksums are" + + " verified only during user-initiated health checks; 'storeAndVerify' – checksums are" + + " calculated and stored on page flushes, verification is performed on each page load," + + " errors are reported in the log; 'storeAndThrow' – same as `storeAndVerify` with" + + " addition of exceptions thrown on errors, this mode is useful for debugging and" + + " testing, but should be avoided in a production environment;" + + " 'storeAndSwitchReadOnlyMode' (default) - Same as 'storeAndVerify' with addition that" + + " storage will be switched in read only mode till it will not be repaired.", OChecksumMode.class, OChecksumMode.StoreAndSwitchReadOnlyMode, false), STORAGE_CHECK_LATEST_OPERATION_ID( "storage.checkLatestOperationId", - "Indicates wether storage should be checked for latest operation id, " - + "to ensure that all the records are needed to restore database are stored into the WAL (true by default)", + "Indicates wether storage should be checked for latest operation id, to ensure that all the" + + " records are needed to restore database are stored into the WAL (true by default)", Boolean.class, true), @@ -377,20 +385,23 @@ public enum OGlobalConfiguration { // ENVIRONMENT STORAGE_DOUBLE_WRITE_LOG_MAX_SEG_SIZE( "storage.doubleWriteLog.maxSegSize", - "Maximum size of double write log segment in megabytes, -1 means that size will be calculated automatically", + "Maximum size of double write log segment in megabytes, -1 means that size will be calculated" + + " automatically", Integer.class, -1), STORAGE_DOUBLE_WRITE_LOG_MAX_SEG_SIZE_PERCENT( "storage.doubleWriteLog.maxSegSizePercent", - "Maximum size of segment of double write log in percents, should be set to value bigger than 0", + "Maximum size of segment of double write log in percents, should be set to value bigger than" + + " 0", Integer.class, 5), STORAGE_DOUBLE_WRITE_LOG_MIN_SEG_SIZE( "storage.doubleWriteLog.minSegSize", - "Minimum size of segment of double write log in megabytes, should be set to value bigger than 0. " - + "If both set maximum and minimum size of segments. Minimum size always will have priority over maximum size.", + "Minimum size of segment of double write log in megabytes, should be set to value bigger than" + + " 0. If both set maximum and minimum size of segments. Minimum size always will have" + + " priority over maximum size.", Integer.class, 256), @@ -405,7 +416,7 @@ public enum OGlobalConfiguration { // ENVIRONMENT "storage.cluster.version", "Binary version of cluster which will be used inside of storage", Integer.class, - OPaginatedCluster.getLatestBinaryVersion()), + 2), STORAGE_PRINT_WAL_PERFORMANCE_STATISTICS( "storage.printWALPerformanceStatistics", @@ -422,14 +433,15 @@ public enum OGlobalConfiguration { // ENVIRONMENT @Deprecated STORAGE_TRACK_CHANGED_RECORDS_IN_WAL( "storage.trackChangedRecordsInWAL", - "If this flag is set metadata which contains rids of changed records is added at the end of each atomic operation", + "If this flag is set metadata which contains rids of changed records is added at the end of" + + " each atomic operation", Boolean.class, false), STORAGE_INTERNAL_JOURNALED_TX_STREAMING_PORT( "storage.internal.journaled.tx.streaming.port", - "Activates journaled tx streaming " - + "on the given TCP/IP port. Used for internal testing purposes only. Never touch it if you don't know what you doing.", + "Activates journaled tx streaming on the given TCP/IP port. Used for internal testing" + + " purposes only. Never touch it if you don't know what you doing.", Integer.class, null), @@ -448,7 +460,8 @@ public enum OGlobalConfiguration { // ENVIRONMENT @Deprecated USE_CHM_CACHE( "storage.useCHMCache", - "Whether to use new disk cache implementation based on CHM or old one based on cuncurrent queues", + "Whether to use new disk cache implementation based on CHM or old one based on cuncurrent" + + " queues", Boolean.class, true), @@ -460,7 +473,8 @@ public enum OGlobalConfiguration { // ENVIRONMENT WAL_CACHE_SIZE( "storage.wal.cacheSize", - "Maximum size of WAL cache (in amount of WAL pages, each page is 4k) If set to 0, caching will be disabled", + "Maximum size of WAL cache (in amount of WAL pages, each page is 4k) If set to 0, caching" + + " will be disabled", Integer.class, 65536), @@ -552,7 +566,8 @@ public enum OGlobalConfiguration { // ENVIRONMENT WAL_REPORT_AFTER_OPERATIONS_DURING_RESTORE( "storage.wal.reportAfterOperationsDuringRestore", - "Amount of processed log operations, after which status of data restore procedure will be printed (0 or a negative value, disables the logging)", + "Amount of processed log operations, after which status of data restore procedure will be" + + " printed (0 or a negative value, disables the logging)", Integer.class, 10000), @@ -577,7 +592,8 @@ public enum OGlobalConfiguration { // ENVIRONMENT WAL_FULL_CHECKPOINT_SHUTDOWN_TIMEOUT( "storage.wal.fullCheckpointShutdownTimeout", - "The amount of time the DB will wait, until a checkpoint is finished, during a DB shutdown (in seconds)", + "The amount of time the DB will wait, until a checkpoint is finished, during a DB shutdown" + + " (in seconds)", Integer.class, 60 * 10), @@ -596,20 +612,22 @@ public enum OGlobalConfiguration { // ENVIRONMENT DISK_CACHE_PRINT_FLUSH_TILL_SEGMENT_STATISTICS( "storage.diskCache.printFlushTillSegmentStatistics", - "Print information about write cache state when it is requested to flush all data operations on which are logged " - + "till provided WAL segment", + "Print information about write cache state when it is requested to flush all data operations" + + " on which are logged till provided WAL segment", Boolean.class, true), DISK_CACHE_PRINT_FLUSH_FILE_STATISTICS( "storage.diskCache.printFlushFileStatistics", - "Print information about write cache state when it is requested to flush all data of file specified", + "Print information about write cache state when it is requested to flush all data of file" + + " specified", Boolean.class, true), DISK_CACHE_PRINT_FILE_REMOVE_STATISTICS( "storage.diskCache.printFileRemoveStatistics", - "Print information about write cache state when it is requested to clear all data of file specified", + "Print information about write cache state when it is requested to clear all data of file" + + " specified", Boolean.class, true), @@ -621,19 +639,22 @@ public enum OGlobalConfiguration { // ENVIRONMENT DISK_CACHE_EXCLUSIVE_FLUSH_BOUNDARY( "storage.diskCache.exclusiveFlushBoundary", - "If portion of exclusive pages into cache exceeds this value we start to flush only exclusive pages from disk cache", + "If portion of exclusive pages into cache exceeds this value we start to flush only exclusive" + + " pages from disk cache", Float.class, 0.9), DISK_CACHE_CHUNK_SIZE( "storage.diskCache.chunkSize", - "Maximum distance between two pages after which they are not treated as single continous chunk", + "Maximum distance between two pages after which they are not treated as single continous" + + " chunk", Integer.class, 256), DISK_CACHE_EXCLUSIVE_PAGES_BOUNDARY( "storage.diskCache.exclusiveBoundary", - "Portion of exclusive pages in write cache after which we will start to flush only exclusive pages", + "Portion of exclusive pages in write cache after which we will start to flush only exclusive" + + " pages", Float.class, 0.7), @@ -673,8 +694,9 @@ public enum OGlobalConfiguration { // ENVIRONMENT @Deprecated RECORD_DOWNSIZING_ENABLED( "record.downsizing.enabled", - "On updates, if the record size is lower than before, this reduces the space taken accordingly. " - + "If enabled this could increase defragmentation, but it reduces the used disk space", + "On updates, if the record size is lower than before, this reduces the space taken" + + " accordingly. If enabled this could increase defragmentation, but it reduces the used" + + " disk space", Boolean.class, true), @@ -705,7 +727,8 @@ public enum OGlobalConfiguration { // ENVIRONMENT DB_CACHED_POOL_CLEAN_UP_TIMEOUT( "db.cached.pool.cleanUpTimeout", - "Default timeout for clean up cache from unused or closed database pools, value in milliseconds", + "Default timeout for clean up cache from unused or closed database pools, value in" + + " milliseconds", Long.class, 600_000), @@ -728,8 +751,9 @@ public enum OGlobalConfiguration { // ENVIRONMENT DB_MVCC_THROWFAST( "db.mvcc.throwfast", - "Use fast-thrown exceptions for MVCC OConcurrentModificationExceptions. No context information will be available. " - + "Set to true, when these exceptions are thrown, but the details are not necessary", + "Use fast-thrown exceptions for MVCC OConcurrentModificationExceptions. No context" + + " information will be available. Set to true, when these exceptions are thrown, but the" + + " details are not necessary", Boolean.class, false, true), @@ -743,22 +767,24 @@ public enum OGlobalConfiguration { // ENVIRONMENT // INDEX INDEX_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD( "index.embeddedToSbtreeBonsaiThreshold", - "Amount of values, after which the index implementation will use an sbtree as a values container. Set to -1, to disable and force using an sbtree", + "Amount of values, after which the index implementation will use an sbtree as a values" + + " container. Set to -1, to disable and force using an sbtree", Integer.class, 40, true), INDEX_SBTREEBONSAI_TO_EMBEDDED_THRESHOLD( "index.sbtreeBonsaiToEmbeddedThreshold", - "Amount of values, after which index implementation will use an embedded values container (disabled by default)", + "Amount of values, after which index implementation will use an embedded values container" + + " (disabled by default)", Integer.class, -1, true), HASH_TABLE_SPLIT_BUCKETS_BUFFER_LENGTH( "hashTable.slitBucketsBuffer.length", - "Length of buffer (in pages), where buckets " - + "that were split, but not flushed to the disk, are kept. This buffer is used to minimize random IO overhead", + "Length of buffer (in pages), where buckets that were split, but not flushed to the disk, are" + + " kept. This buffer is used to minimize random IO overhead", Integer.class, 1500), @@ -773,16 +799,17 @@ public enum OGlobalConfiguration { // ENVIRONMENT INDEX_ALLOW_MANUAL_INDEXES( "index.allowManualIndexes", - "Switch which allows usage of manual indexes inside OrientDB. " - + "It is not recommended to switch it on, because manual indexes are deprecated, not supported and will be removed in next versions", + "Switch which allows usage of manual indexes inside OrientDB. It is not recommended to switch" + + " it on, because manual indexes are deprecated, not supported and will be removed in" + + " next versions", Boolean.class, true), INDEX_ALLOW_MANUAL_INDEXES_WARNING( "index.allowManualIndexesWarning", - "Switch which triggers printing of waring message any time when " - + "manual indexes are used. It is not recommended to switch it off, because manual indexes are deprecated, " - + "not supported and will be removed in next versions", + "Switch which triggers printing of waring message any time when manual indexes are used. It" + + " is not recommended to switch it off, because manual indexes are deprecated, not" + + " supported and will be removed in next versions", Boolean.class, true), @@ -800,7 +827,8 @@ public enum OGlobalConfiguration { // ENVIRONMENT @Deprecated INDEX_TX_MODE( "index.txMode", - "Indicates the index durability level in TX mode. Can be ROLLBACK_ONLY or FULL (ROLLBACK_ONLY by default)", + "Indicates the index durability level in TX mode. Can be ROLLBACK_ONLY or FULL (ROLLBACK_ONLY" + + " by default)", String.class, "FULL"), @@ -810,7 +838,8 @@ public enum OGlobalConfiguration { // ENVIRONMENT // SBTREE SBTREE_MAX_DEPTH( "sbtree.maxDepth", - "Maximum depth of sbtree, which will be traversed during key look up until it will be treated as broken (64 by default)", + "Maximum depth of sbtree, which will be traversed during key look up until it will be treated" + + " as broken (64 by default)", Integer.class, 64), @@ -822,13 +851,15 @@ public enum OGlobalConfiguration { // ENVIRONMENT SBTREE_MAX_EMBEDDED_VALUE_SIZE( "sbtree.maxEmbeddedValueSize", - "Maximum size of value which can be put in an SBTree without creation link to a standalone page in bytes (40960 by default)", + "Maximum size of value which can be put in an SBTree without creation link to a standalone" + + " page in bytes (40960 by default)", Integer.class, 40960), SBTREEBONSAI_BUCKET_SIZE( "sbtreebonsai.bucketSize", - "Size of bucket in OSBTreeBonsai (in kB). Contract: bucketSize < storagePageSize, storagePageSize % bucketSize == 0", + "Size of bucket in OSBTreeBonsai (in kB). Contract: bucketSize < storagePageSize," + + " storagePageSize % bucketSize == 0", Integer.class, 2), @@ -840,13 +871,15 @@ public enum OGlobalConfiguration { // ENVIRONMENT SBTREEBONSAI_LINKBAG_CACHE_EVICTION_SIZE( "sbtreebonsai.linkBagCache.evictionSize", - "The number of cached LINKBAG collections, which will be removed, when the cache limit is reached", + "The number of cached LINKBAG collections, which will be removed, when the cache limit is" + + " reached", Integer.class, 1000), SBTREEBOSAI_FREE_SPACE_REUSE_TRIGGER( "sbtreebonsai.freeSpaceReuseTrigger", - "How much free space should be in an sbtreebonsai file, before it will be reused during the next allocation", + "How much free space should be in an sbtreebonsai file, before it will be reused during the" + + " next allocation", Float.class, 0.5), @@ -859,14 +892,16 @@ public enum OGlobalConfiguration { // ENVIRONMENT RID_BAG_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD( "ridBag.embeddedToSbtreeBonsaiThreshold", - "Amount of values after which a LINKBAG implementation will use sbtree as values container. Set to -1 to always use an sbtree", + "Amount of values after which a LINKBAG implementation will use sbtree as values container." + + " Set to -1 to always use an sbtree", Integer.class, 40, true), RID_BAG_SBTREEBONSAI_TO_EMBEDDED_THRESHOLD( "ridBag.sbtreeBonsaiToEmbeddedToThreshold", - "Amount of values, after which a LINKBAG implementation will use an embedded values container (disabled by default)", + "Amount of values, after which a LINKBAG implementation will use an embedded values container" + + " (disabled by default)", Integer.class, -1, true), @@ -891,7 +926,8 @@ public enum OGlobalConfiguration { // ENVIRONMENT // SECURITY SECURITY_USER_PASSWORD_SALT_ITERATIONS( "security.userPasswordSaltIterations", - "Number of iterations to generate the salt or user password. Changing this setting does not affect stored passwords", + "Number of iterations to generate the salt or user password. Changing this setting does not" + + " affect stored passwords", Integer.class, 65536), @@ -969,7 +1005,8 @@ public enum OGlobalConfiguration { // ENVIRONMENT NETWORK_BINARY_DNS_LOADBALANCING_TIMEOUT( "network.binary.loadBalancing.timeout", - "Maximum time (in ms) to wait for the answer from DNS about the TXT record for load balancing", + "Maximum time (in ms) to wait for the answer from DNS about the TXT record for load" + + " balancing", Integer.class, 2000, true), @@ -983,7 +1020,8 @@ public enum OGlobalConfiguration { // ENVIRONMENT NETWORK_BINARY_MIN_PROTOCOL_VERSION( "network.binary.minProtocolVersion", - "Set the minimum enabled binary protocol version and disable all backward compatible behaviour for version previous the one specified", + "Set the minimum enabled binary protocol version and disable all backward compatible" + + " behaviour for version previous the one specified", Integer.class, 26, false), @@ -997,7 +1035,8 @@ public enum OGlobalConfiguration { // ENVIRONMENT NETWORK_BINARY_ALLOW_NO_TOKEN( "network.binary.allowNoToken", - "Backward compatibility option to allow binary connections without tokens (STRONGLY DISCOURAGED, FOR SECURITY REASONS)", + "Backward compatibility option to allow binary connections without tokens (STRONGLY" + + " DISCOURAGED, FOR SECURITY REASONS)", Boolean.class, Boolean.FALSE, true), @@ -1014,7 +1053,8 @@ public enum OGlobalConfiguration { // ENVIRONMENT NETWORK_HTTP_SERVER_INFO( "network.http.serverInfo", - "Server info to send in HTTP responses. Change the default if you want to hide it is a OrientDB Server", + "Server info to send in HTTP responses. Change the default if you want to hide it is a" + + " OrientDB Server", String.class, "OrientDB Server v." + OConstants.getVersion(), true), @@ -1041,7 +1081,8 @@ public enum OGlobalConfiguration { // ENVIRONMENT NETWORK_HTTP_JSONP_ENABLED( "network.http.jsonp", - "Enable the usage of JSONP, if requested by the client. The parameter name to use is 'callback'", + "Enable the usage of JSONP, if requested by the client. The parameter name to use is" + + " 'callback'", Boolean.class, false, true), @@ -1103,7 +1144,9 @@ public enum OGlobalConfiguration { // ENVIRONMENT 0, new OProfileDumpIntervalChangeCallback()), - /** @Since 2.2.27 */ + /** + * @Since 2.2.27 + */ PROFILER_AUTODUMP_TYPE( "profiler.autoDump.type", "Type of profiler dump between 'full' or 'performance'", @@ -1132,7 +1175,8 @@ public enum OGlobalConfiguration { // ENVIRONMENT SEQUENCE_RETRY_DELAY( "sequence.retryDelay", - "Maximum number of ms to wait between concurrent modification exceptions. The value is computed as random between 1 and this number", + "Maximum number of ms to wait between concurrent modification exceptions. The value is" + + " computed as random between 1 and this number", Integer.class, 200), @@ -1182,7 +1226,8 @@ public void change(final Object iCurrentValue, final Object iNewValue) { // LOG LOG_SUPPORTS_ANSI( "log.console.ansi", - "ANSI Console support. 'auto' means automatic check if it is supported, 'true' to force using ANSI, 'false' to avoid using ANSI", + "ANSI Console support. 'auto' means automatic check if it is supported, 'true' to force using" + + " ANSI, 'false' to avoid using ANSI", String.class, "auto"), @@ -1191,7 +1236,7 @@ public void change(final Object iCurrentValue, final Object iNewValue) { "cache.local.impl", "Local Record cache implementation", String.class, - ORecordCacheWeakRefs.class.getName()), + "com.orientechnologies.orient.core.cache.ORecordCacheWeakRefs"), // COMMAND COMMAND_TIMEOUT("command.timeout", "Default timeout for commands (in ms)", Long.class, 0, true), @@ -1219,8 +1264,8 @@ public void change(final Object iCurrentValue, final Object iNewValue) { // QUERY QUERY_REMOTE_RESULTSET_PAGE_SIZE( "query.remoteResultSet.pageSize", - "The size of a remote ResultSet page, ie. the number of records" - + "that are fetched together during remote query execution. This has to be set on the client.", + "The size of a remote ResultSet page, ie. the number of recordsthat are fetched together" + + " during remote query execution. This has to be set on the client.", Integer.class, 1000), @@ -1244,34 +1289,41 @@ public void change(final Object iCurrentValue, final Object iNewValue) { QUERY_PARALLEL_RESULT_QUEUE_SIZE( "query.parallelResultQueueSize", - "Size of the queue that holds results on parallel execution. The queue is blocking, so in case the queue is full, the query threads will be in a wait state", + "Size of the queue that holds results on parallel execution. The queue is blocking, so in" + + " case the queue is full, the query threads will be in a wait state", Integer.class, 20000), QUERY_SCAN_BATCH_SIZE( "query.scanBatchSize", - "Scan clusters in blocks of records. This setting reduces the lock time on the cluster during scans." - + " A high value mean a faster execution, but also a lower concurrency level. Set to 0 to disable batch scanning. Disabling batch scanning is suggested for read-only databases only", + "Scan clusters in blocks of records. This setting reduces the lock time on the cluster during" + + " scans. A high value mean a faster execution, but also a lower concurrency level. Set" + + " to 0 to disable batch scanning. Disabling batch scanning is suggested for read-only" + + " databases only", Long.class, 1000), QUERY_SCAN_THRESHOLD_TIP( "query.scanThresholdTip", - "If the total number of records scanned in a query exceeds this setting, then a warning is given. (Use 0 to disable)", + "If the total number of records scanned in a query exceeds this setting, then a warning is" + + " given. (Use 0 to disable)", Long.class, 50000), QUERY_LIMIT_THRESHOLD_TIP( "query.limitThresholdTip", - "If the total number of returned records exceeds this value, then a warning is given. (Use 0 to disable)", + "If the total number of returned records exceeds this value, then a warning is given. (Use 0" + + " to disable)", Long.class, 10000), QUERY_MAX_HEAP_ELEMENTS_ALLOWED_PER_OP( "query.maxHeapElementsAllowedPerOp", - "Maximum number of elements (records) allowed in a single query for memory-intensive operations (eg. ORDER BY in heap). " - + "If exceeded, the query fails with an OCommandExecutionException. Negative number means no limit." - + "This setting is intended as a safety measure against excessive resource consumption from a single query (eg. prevent OutOfMemory)", + "Maximum number of elements (records) allowed in a single query for memory-intensive" + + " operations (eg. ORDER BY in heap). If exceeded, the query fails with an" + + " OCommandExecutionException. Negative number means no limit.This setting is intended" + + " as a safety measure against excessive resource consumption from a single query (eg." + + " prevent OutOfMemory)", Long.class, 500_000), @@ -1290,11 +1342,13 @@ public void change(final Object iCurrentValue, final Object iNewValue) { // GRAPH SQL_GRAPH_CONSISTENCY_MODE( "sql.graphConsistencyMode", - "Consistency mode for graphs. It can be 'tx' (default), 'notx_sync_repair' and 'notx_async_repair'. " - + "'tx' uses transactions to maintain consistency. Instead both 'notx_sync_repair' and 'notx_async_repair' do not use transactions, " - + "and the consistency, in case of JVM crash, is guaranteed by a database repair operation that run at startup. " - + "With 'notx_sync_repair' the repair is synchronous, so the database comes online after the repair is ended, while " - + "with 'notx_async_repair' the repair is a background process", + "Consistency mode for graphs. It can be 'tx' (default), 'notx_sync_repair' and" + + " 'notx_async_repair'. 'tx' uses transactions to maintain consistency. Instead both" + + " 'notx_sync_repair' and 'notx_async_repair' do not use transactions, and the" + + " consistency, in case of JVM crash, is guaranteed by a database repair operation that" + + " run at startup. With 'notx_sync_repair' the repair is synchronous, so the database" + + " comes online after the repair is ended, while with 'notx_async_repair' the repair is" + + " a background process", String.class, "tx"), @@ -1304,7 +1358,8 @@ public void change(final Object iCurrentValue, final Object iNewValue) { */ CLIENT_CHANNEL_MAX_POOL( "client.channel.maxPool", - "Maximum size of pool of network channels between client and server. A channel is a TCP/IP connection", + "Maximum size of pool of network channels between client and server. A channel is a TCP/IP" + + " connection", Integer.class, 100), @@ -1314,7 +1369,8 @@ public void change(final Object iCurrentValue, final Object iNewValue) { */ CLIENT_CONNECT_POOL_WAIT_TIMEOUT( "client.connectionPool.waitTimeout", - "Maximum time, where the client should wait for a connection from the pool, when all connections busy", + "Maximum time, where the client should wait for a connection from the pool, when all" + + " connections busy", Integer.class, 5000, true), @@ -1368,7 +1424,8 @@ public void change(final Object iCurrentValue, final Object iNewValue) { SERVER_LOG_DUMP_CLIENT_EXCEPTION_LEVEL( "server.log.dumpClientExceptionLevel", - "Logs client exceptions. Use any level supported by Java java.util.logging.Level class: OFF, FINE, CONFIG, INFO, WARNING, SEVERE", + "Logs client exceptions. Use any level supported by Java java.util.logging.Level class: OFF," + + " FINE, CONFIG, INFO, WARNING, SEVERE", String.class, Level.FINE.getName()), @@ -1388,7 +1445,9 @@ public void change(final Object iCurrentValue, final Object iNewValue) { false), // DISTRIBUTED - /** @Since 2.2.18 */ + /** + * @Since 2.2.18 + */ DISTRIBUTED_DUMP_STATS_EVERY( "distributed.dumpStatsEvery", "Time in ms to dump the cluster stats. Set to 0 to disable such dump", @@ -1454,59 +1513,77 @@ public void change(final Object iCurrentValue, final Object iNewValue) { DISTRIBUTED_ASYNCH_QUEUE_SIZE( "distributed.asynchQueueSize", - "Queue size to handle distributed asynchronous operations. The bigger is the queue, the more operation are buffered, but also more memory it's consumed. 0 = dynamic allocation, which means up to 2^31-1 entries", + "Queue size to handle distributed asynchronous operations. The bigger is the queue, the more" + + " operation are buffered, but also more memory it's consumed. 0 = dynamic allocation," + + " which means up to 2^31-1 entries", Integer.class, 0), DISTRIBUTED_ASYNCH_RESPONSES_TIMEOUT( "distributed.asynchResponsesTimeout", - "Maximum timeout (in ms) to collect all the asynchronous responses from replication. After this time the operation is rolled back (through an UNDO)", + "Maximum timeout (in ms) to collect all the asynchronous responses from replication. After" + + " this time the operation is rolled back (through an UNDO)", Long.class, 15000l), DISTRIBUTED_PURGE_RESPONSES_TIMER_DELAY( "distributed.purgeResponsesTimerDelay", - "Maximum timeout (in ms) to collect all the asynchronous responses from replication. This is the delay the purge thread uses to check asynchronous requests in timeout", + "Maximum timeout (in ms) to collect all the asynchronous responses from replication. This is" + + " the delay the purge thread uses to check asynchronous requests in timeout", Long.class, 15000l), - /** @Since 2.2.7 */ + /** + * @Since 2.2.7 + */ DISTRIBUTED_TX_EXPIRE_TIMEOUT( "distributed.txAliveTimeout", - "Maximum timeout (in ms) a distributed transaction can be alive. This timeout is to rollback pending transactions after a while", + "Maximum timeout (in ms) a distributed transaction can be alive. This timeout is to rollback" + + " pending transactions after a while", Long.class, 1800000l, true), - /** @Since 2.2.6 */ + /** + * @Since 2.2.6 + */ DISTRIBUTED_REQUEST_CHANNELS( "distributed.requestChannels", "Number of network channels used to send requests", Integer.class, 1), - /** @Since 2.2.6 */ + /** + * @Since 2.2.6 + */ DISTRIBUTED_RESPONSE_CHANNELS( "distributed.responseChannels", "Number of network channels used to send responses", Integer.class, 1), - /** @Since 2.2.5 */ + /** + * @Since 2.2.5 + */ DISTRIBUTED_HEARTBEAT_TIMEOUT( "distributed.heartbeatTimeout", - "Maximum time in ms to wait for the heartbeat. If the server does not respond in time, it is put offline", + "Maximum time in ms to wait for the heartbeat. If the server does not respond in time, it is" + + " put offline", Long.class, 10000l), - /** @Since 2.2.5 */ + /** + * @Since 2.2.5 + */ DISTRIBUTED_CHECK_HEALTH_CAN_OFFLINE_SERVER( "distributed.checkHealthCanOfflineServer", "In case a server does not respond to the heartbeat message, it is set offline", Boolean.class, false), - /** @Since 2.2.5 */ + /** + * @Since 2.2.5 + */ DISTRIBUTED_CHECK_HEALTH_EVERY( "distributed.checkHealthEvery", "Time in ms to check the cluster health. Set to 0 to disable it", @@ -1516,28 +1593,38 @@ public void change(final Object iCurrentValue, final Object iNewValue) { /** Since 2.2.4 */ DISTRIBUTED_AUTO_REMOVE_OFFLINE_SERVERS( "distributed.autoRemoveOfflineServers", - "This is the amount of time (in ms) the server has to be OFFLINE, before it is automatically removed from the distributed configuration. -1 = never, 0 = immediately, >0 the actual time to wait", + "This is the amount of time (in ms) the server has to be OFFLINE, before it is automatically" + + " removed from the distributed configuration. -1 = never, 0 = immediately, >0 the" + + " actual time to wait", Long.class, 0, true), - /** @Since 2.2.0 */ + /** + * @Since 2.2.0 + */ DISTRIBUTED_PUBLISH_NODE_STATUS_EVERY( "distributed.publishNodeStatusEvery", - "Time in ms to publish the node status on distributed map. Set to 0 to disable such refresh of node configuration", + "Time in ms to publish the node status on distributed map. Set to 0 to disable such refresh" + + " of node configuration", Long.class, 10000l, true), - /** @Since 2.2.0 */ + /** + * @Since 2.2.0 + */ DISTRIBUTED_REPLICATION_PROTOCOL_VERSION( "distributed.replicationProtocol.version", - "1 for legacy replication model (v 3.0 and previous), 2 for coordinated replication (v 3.1 and next)", + "1 for legacy replication model (v 3.0 and previous), 2 for coordinated replication (v 3.1" + + " and next)", Integer.class, 1, true), - /** @Since 2.2.0 */ + /** + * @Since 2.2.0 + */ @OApi(maturity = OApi.MATURITY.NEW) DISTRIBUTED_LOCAL_QUEUESIZE( "distributed.localQueueSize", @@ -1545,23 +1632,31 @@ public void change(final Object iCurrentValue, final Object iNewValue) { Integer.class, 10000), - /** @Since 2.2.0 */ + /** + * @Since 2.2.0 + */ @OApi(maturity = OApi.MATURITY.NEW) DISTRIBUTED_DB_WORKERTHREADS( "distributed.dbWorkerThreads", - "Number of parallel worker threads per database that process distributed messages. Use 0 for automatic", + "Number of parallel worker threads per database that process distributed messages. Use 0 for" + + " automatic", Integer.class, 0), - /** @Since 2.1.3 */ + /** + * @Since 2.1.3 + */ @OApi(maturity = OApi.MATURITY.NEW) DISTRIBUTED_BACKUP_DIRECTORY( "distributed.backupDirectory", - "Directory where the copy of an existent database is saved, before it is downloaded from the cluster. Leave it empty to avoid the backup.", + "Directory where the copy of an existent database is saved, before it is downloaded from the" + + " cluster. Leave it empty to avoid the backup.", String.class, "../backup/databases"), - /** @Since 2.2.15 */ + /** + * @Since 2.2.15 + */ @OApi(maturity = OApi.MATURITY.NEW) @Deprecated DISTRIBUTED_BACKUP_TRY_INCREMENTAL_FIRST( @@ -1570,16 +1665,21 @@ public void change(final Object iCurrentValue, final Object iNewValue) { Boolean.class, true), - /** @Since 2.1 */ + /** + * @Since 2.1 + */ @OApi(maturity = OApi.MATURITY.NEW) DISTRIBUTED_CONCURRENT_TX_MAX_AUTORETRY( "distributed.concurrentTxMaxAutoRetry", - "Maximum attempts the transaction coordinator should execute a transaction automatically, if records are locked. (Minimum is 1 = no attempts)", + "Maximum attempts the transaction coordinator should execute a transaction automatically, if" + + " records are locked. (Minimum is 1 = no attempts)", Integer.class, 15, true), - /** @Since 2.2.7 */ + /** + * @Since 2.2.7 + */ @OApi(maturity = OApi.MATURITY.NEW) DISTRIBUTED_ATOMIC_LOCK_TIMEOUT( "distributed.atomicLockTimeout", @@ -1588,18 +1688,22 @@ public void change(final Object iCurrentValue, final Object iNewValue) { 100, true), - /** @Since 2.1 */ + /** + * @Since 2.1 + */ @OApi(maturity = OApi.MATURITY.NEW) DISTRIBUTED_CONCURRENT_TX_AUTORETRY_DELAY( "distributed.concurrentTxAutoRetryDelay", - "Delay (in ms) between attempts on executing a distributed transaction, which had failed because of locked records. (0=no delay)", + "Delay (in ms) between attempts on executing a distributed transaction, which had failed" + + " because of locked records. (0=no delay)", Integer.class, 1000, true), DISTRIBUTED_TRANSACTION_SEQUENCE_SET_SIZE( "distributed.transactionSequenceSetSize", - "Size of the set of sequences used by distributed transactions, correspond to the amount of transactions commits that can be active at the same time", + "Size of the set of sequences used by distributed transactions, correspond to the amount of" + + " transactions commits that can be active at the same time", Integer.class, 1000, false), @@ -1608,19 +1712,25 @@ public void change(final Object iCurrentValue, final Object iNewValue) { "db.document.serializer", "The default record serializer used by the document database", String.class, - ORecordSerializerBinary.NAME), + "ORecordSerializerBinary"), - /** @Since 2.2 */ + /** + * @Since 2.2 + */ @OApi(maturity = OApi.MATURITY.NEW) CLIENT_KRB5_CONFIG( "client.krb5.config", "Location of the Kerberos configuration file", String.class, null), - /** @Since 2.2 */ + /** + * @Since 2.2 + */ @OApi(maturity = OApi.MATURITY.NEW) CLIENT_KRB5_CCNAME( "client.krb5.ccname", "Location of the Kerberos client ticketcache", String.class, null), - /** @Since 2.2 */ + /** + * @Since 2.2 + */ @OApi(maturity = OApi.MATURITY.NEW) CLIENT_KRB5_KTNAME( "client.krb5.ktname", "Location of the Kerberos client keytab", String.class, null), @@ -1628,7 +1738,8 @@ public void change(final Object iCurrentValue, final Object iNewValue) { @OApi(maturity = OApi.MATURITY.STABLE) CLIENT_CONNECTION_STRATEGY( "client.connection.strategy", - "Strategy used for open connections from a client in case of multiple servers, possible options:STICKY, ROUND_ROBIN_CONNECT, ROUND_ROBIN_REQUEST", + "Strategy used for open connections from a client in case of multiple servers, possible" + + " options:STICKY, ROUND_ROBIN_CONNECT, ROUND_ROBIN_REQUEST", String.class, null), @@ -1639,7 +1750,9 @@ public void change(final Object iCurrentValue, final Object iNewValue) { Boolean.class, true), - /** @Since 2.2 */ + /** + * @Since 2.2 + */ @OApi(maturity = OApi.MATURITY.NEW) CLIENT_CREDENTIAL_INTERCEPTOR( "client.credentialinterceptor", @@ -1677,7 +1790,9 @@ public void change(final Object iCurrentValue, final Object iNewValue) { false, true), - /** @Since 2.2 */ + /** + * @Since 2.2 + */ @OApi(maturity = OApi.MATURITY.NEW) CREATE_DEFAULT_USERS( "security.createDefaultUsers", @@ -1689,7 +1804,9 @@ public void change(final Object iCurrentValue, final Object iNewValue) { "Indicates whether access with default users should show a warning", Boolean.class, true), - /** @Since 2.2 */ + /** + * @Since 2.2 + */ @OApi(maturity = OApi.MATURITY.NEW) SERVER_SECURITY_FILE( "server.security.file", @@ -1726,7 +1843,8 @@ public void change(final Object iCurrentValue, final Object iNewValue) { @Deprecated JNA_DISABLE_USE_SYSTEM_LIBRARY( "jna.disable.system.library", - "This property disables using JNA, should it be installed on your system. (Default true) To use JNA bundled with database", + "This property disables using JNA, should it be installed on your system. (Default true) To" + + " use JNA bundled with database", boolean.class, true), @@ -1778,14 +1896,16 @@ public void change(final Object iCurrentValue, final Object iNewValue) { @Deprecated TX_AUTO_RETRY( "tx.autoRetry", - "Maximum number of automatic retry if some resource has been locked in the middle of the transaction (Timeout exception)", + "Maximum number of automatic retry if some resource has been locked in the middle of the" + + " transaction (Timeout exception)", Integer.class, 1), @Deprecated TX_LOG_SYNCH( "tx.log.synch", - "Executes a synch against the file-system at every log entry. This slows down transactions but guarantee transaction reliability on unreliable drives", + "Executes a synch against the file-system at every log entry. This slows down transactions" + + " but guarantee transaction reliability on unreliable drives", Boolean.class, Boolean.FALSE), @@ -1815,12 +1935,16 @@ public void change(final Object iCurrentValue, final Object iNewValue) { AUTO_CLOSE_DELAY( "storage.autoCloseDelay", "Storage auto close delay time in minutes", Integer.class, 20), - /** @Since 3.1 */ + /** + * @Since 3.1 + */ @OApi(maturity = OApi.MATURITY.NEW) DISTRIBUTED( "distributed", "Enable the clustering mode", Boolean.class, false, false, false, true), - /** @Since 3.1 */ + /** + * @Since 3.1 + */ @OApi(maturity = OApi.MATURITY.NEW) DISTRIBUTED_NODE_NAME( "distributed.nodeName", @@ -1983,7 +2107,9 @@ public static void dumpConfiguration(final PrintStream out) { */ public static OGlobalConfiguration findByKey(final String iKey) { for (OGlobalConfiguration v : values()) { - if (v.getKey().equalsIgnoreCase(iKey)) return v; + if (v.getKey().equalsIgnoreCase(iKey)) { + return v; + } } return null; } @@ -2011,7 +2137,9 @@ private static void readConfiguration() { String prop; for (OGlobalConfiguration config : values()) { prop = System.getProperty(config.key); - if (prop != null) config.setValue(prop); + if (prop != null) { + config.setValue(prop); + } } for (OGlobalConfiguration config : values()) { @@ -2028,7 +2156,9 @@ private static void readConfiguration() { public static String getEnvKey(OGlobalConfiguration config) { - if (!config.env) return null; + if (!config.env) { + return null; + } return "ORIENTDB_" + config.name(); } @@ -2039,7 +2169,7 @@ public T getValue() { /** * @return true if configuration was changed from default value and false - * otherwise. + * otherwise. */ public boolean isChanged() { return value != nullValue; @@ -2048,12 +2178,16 @@ public boolean isChanged() { public void setValue(final Object iValue) { Object oldValue = value; - if (iValue != null) - if (type == Boolean.class) value = Boolean.parseBoolean(iValue.toString()); - else if (type == Integer.class) value = Integer.parseInt(iValue.toString()); - else if (type == Float.class) value = Float.parseFloat(iValue.toString()); - else if (type == String.class) value = iValue.toString(); - else if (type.isEnum()) { + if (iValue != null) { + if (type == Boolean.class) { + value = Boolean.parseBoolean(iValue.toString()); + } else if (type == Integer.class) { + value = Integer.parseInt(iValue.toString()); + } else if (type == Float.class) { + value = Float.parseFloat(iValue.toString()); + } else if (type == String.class) { + value = iValue.toString(); + } else if (type.isEnum()) { boolean accepted = false; if (type.isInstance(iValue)) { @@ -2073,8 +2207,13 @@ else if (type.isEnum()) { } } - if (!accepted) throw new IllegalArgumentException("Invalid value of `" + key + "` option."); - } else value = iValue; + if (!accepted) { + throw new IllegalArgumentException("Invalid value of `" + key + "` option."); + } + } else { + value = iValue; + } + } if (changeCallback != null) { try { @@ -2139,39 +2278,32 @@ public String getDescription() { return description; } - private static class OCacheSizeChangeCallback implements OConfigurationChangeCallback { - - @Override - public void change(Object currentValue, Object newValue) { - final Orient orient = Orient.instance(); - if (orient != null) { - final OEngineLocalPaginated engineLocalPaginated = - (OEngineLocalPaginated) orient.getEngineIfRunning(OEngineLocalPaginated.NAME); - if (engineLocalPaginated != null) - engineLocalPaginated.changeCacheSize(((Integer) (newValue)) * 1024L * 1024L); - } - } - } - private static class OProfileEnabledChangeCallbac implements OConfigurationChangeCallback { + public void change(final Object iCurrentValue, final Object iNewValue) { Orient instance = Orient.instance(); if (instance != null) { final OProfiler prof = instance.getProfiler(); - if (prof != null) - if ((Boolean) iNewValue) prof.startRecording(); - else prof.stopRecording(); + if (prof != null) { + if ((Boolean) iNewValue) { + prof.startRecording(); + } else { + prof.stopRecording(); + } + } } } } private static class OProfileConfigChangeCallback implements OConfigurationChangeCallback { + public void change(final Object iCurrentValue, final Object iNewValue) { Orient.instance().getProfiler().configure(iNewValue.toString()); } } private static class OProfileDumpIntervalChangeCallback implements OConfigurationChangeCallback { + public void change(final Object iCurrentValue, final Object iNewValue) { Orient.instance().getProfiler().setAutoDump((Integer) iNewValue); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/config/OStorageConfigurationImpl.java b/core/src/main/java/com/orientechnologies/orient/core/config/OStorageConfigurationImpl.java index eb5310769e8..03b72d770bf 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/config/OStorageConfigurationImpl.java +++ b/core/src/main/java/com/orientechnologies/orient/core/config/OStorageConfigurationImpl.java @@ -110,6 +110,7 @@ public class OStorageConfigurationImpl implements OSerializableStream, OStorageC private transient boolean validation = true; protected OStorageConfigurationUpdateListener updateListener; + /** Version of product release under which storage was created */ private String createdAtVersion; @@ -194,7 +195,9 @@ public void setCreationVersion(String version) { } } - /** @return version of product release under which storage was created. */ + /** + * @return version of product release under which storage was created. + */ public String getCreatedAtVersion() { lock.readLock().lock(); try { @@ -422,7 +425,8 @@ public void fromStream(final byte[] stream, int offset, int length, Charset char OLogManager.instance() .warn( this, - "Information about storage locale is undefined (language is undefined) default locale " + "Information about storage locale is undefined (language is undefined) default" + + " locale " + locale + " will be used"); @@ -430,7 +434,8 @@ public void fromStream(final byte[] stream, int offset, int length, Charset char OLogManager.instance() .warn( this, - "Information about storage locale is undefined (country is undefined) default locale " + "Information about storage locale is undefined (country is undefined) default" + + " locale " + locale + " will be used"); } @@ -672,7 +677,9 @@ public OSerializableStream fromStream(final byte[] iStream) throws OSerializatio return this; } - /** @deprecated because method uses native encoding use {@link #toStream(Charset)} instead. */ + /** + * @deprecated because method uses native encoding use {@link #toStream(Charset)} instead. + */ @Override public byte[] toStream() throws OSerializationException { return toStream(Integer.MAX_VALUE, Charset.defaultCharset()); diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/OCachedDatabasePoolFactoryImpl.java b/core/src/main/java/com/orientechnologies/orient/core/db/OCachedDatabasePoolFactoryImpl.java index f52ea9e18b6..920c0b16516 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/db/OCachedDatabasePoolFactoryImpl.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/OCachedDatabasePoolFactoryImpl.java @@ -134,13 +134,17 @@ public void close() { } } - /** @return true if factory is closed */ + /** + * @return true if factory is closed + */ @Override public boolean isClosed() { return closed; } - /** @return max pool size. Default is 64 */ + /** + * @return max pool size. Default is 64 + */ public int getMaxPoolSize() { return maxPoolSize; } @@ -156,7 +160,9 @@ public OCachedDatabasePoolFactory setMaxPoolSize(int maxPoolSize) { return this; } - /** @throws IllegalStateException if pool factory is closed */ + /** + * @throws IllegalStateException if pool factory is closed + */ private void checkForClose() { if (closed) { throw new IllegalStateException("Cached pool factory is closed!"); diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/ODatabase.java b/core/src/main/java/com/orientechnologies/orient/core/db/ODatabase.java index b35a8cb8c4d..170bf063acc 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/db/ODatabase.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/ODatabase.java @@ -1115,7 +1115,9 @@ > DB registerHook( * commit/retry */ default T executeWithRetry(int nRetries, Function function) - throws IllegalStateException, IllegalArgumentException, ONeedRetryException, + throws IllegalStateException, + IllegalArgumentException, + ONeedRetryException, UnsupportedOperationException { if (nRetries < 1) { throw new IllegalArgumentException("invalid number of retries: " + nRetries); @@ -1125,7 +1127,8 @@ default T executeWithRetry(int nRetries, Function funct if (txActive) { if (tx.getEntryCount() > 0) { throw new IllegalStateException( - "executeWithRetry() cannot be used within a pending (dirty) transaction. Please commit or rollback before invoking it"); + "executeWithRetry() cannot be used within a pending (dirty) transaction. Please commit" + + " or rollback before invoking it"); } } if (!txActive) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/ODatabaseDocumentInternal.java b/core/src/main/java/com/orientechnologies/orient/core/db/ODatabaseDocumentInternal.java index b768726ef1e..1d6b92447ec 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/db/ODatabaseDocumentInternal.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/ODatabaseDocumentInternal.java @@ -64,10 +64,14 @@ public interface ODatabaseDocumentInternal extends ODatabaseSession, ODatabaseIn /** Internal. Gets an instance of sb-tree collection manager for current database. */ OSBTreeCollectionManager getSbTreeCollectionManager(); - /** @return the factory of binary serializers. */ + /** + * @return the factory of binary serializers. + */ OBinarySerializerFactory getSerializerFactory(); - /** @return serializer which is used for document serialization. */ + /** + * @return serializer which is used for document serialization. + */ ORecordSerializer getSerializer(); void setSerializer(ORecordSerializer serializer); diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/ODatabaseInternal.java b/core/src/main/java/com/orientechnologies/orient/core/db/ODatabaseInternal.java index d7d9c117431..0a4d1060616 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/db/ODatabaseInternal.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/ODatabaseInternal.java @@ -131,7 +131,9 @@ default boolean isSharded() { return false; } - /** @return an endpoint for Enterprise features. Null in Community Edition */ + /** + * @return an endpoint for Enterprise features. Null in Community Edition + */ default OEnterpriseEndpoint getEnterpriseEndpoint() { return null; } diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/ODatabaseRecordThreadLocal.java b/core/src/main/java/com/orientechnologies/orient/core/db/ODatabaseRecordThreadLocal.java index 8ca17fa2950..70cf2dd9bc2 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/db/ODatabaseRecordThreadLocal.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/ODatabaseRecordThreadLocal.java @@ -59,12 +59,14 @@ public ODatabaseDocumentInternal get() { if (db == null) { if (Orient.instance().getDatabaseThreadFactory() == null) { throw new ODatabaseException( - "The database instance is not set in the current thread. Be sure to set it with: ODatabaseRecordThreadLocal.instance().set(db);"); + "The database instance is not set in the current thread. Be sure to set it with:" + + " ODatabaseRecordThreadLocal.instance().set(db);"); } else { db = Orient.instance().getDatabaseThreadFactory().getThreadDatabase(); if (db == null) { throw new ODatabaseException( - "The database instance is not set in the current thread. Be sure to set it with: ODatabaseRecordThreadLocal.instance().set(db);"); + "The database instance is not set in the current thread. Be sure to set it with:" + + " ODatabaseRecordThreadLocal.instance().set(db);"); } else { set(db); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/ODatabaseThreadLocalFactory.java b/core/src/main/java/com/orientechnologies/orient/core/db/ODatabaseThreadLocalFactory.java index 847f62a1aba..621e886bac4 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/db/ODatabaseThreadLocalFactory.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/ODatabaseThreadLocalFactory.java @@ -16,7 +16,9 @@ */ package com.orientechnologies.orient.core.db; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public interface ODatabaseThreadLocalFactory { ODatabaseDocumentInternal getThreadDatabase(); diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/OrientDBEmbedded.java b/core/src/main/java/com/orientechnologies/orient/core/db/OrientDBEmbedded.java index 53d63e626f6..63bd8e6aa21 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/db/OrientDBEmbedded.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/OrientDBEmbedded.java @@ -17,6 +17,7 @@ * * For more information: http://orientdb.com * */ + package com.orientechnologies.orient.core.db; import static com.orientechnologies.orient.core.config.OGlobalConfiguration.FILE_DELETE_DELAY; @@ -61,7 +62,6 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; @@ -84,13 +84,15 @@ public class OrientDBEmbedded implements OrientDBInternal { /** Keeps track of next possible storage id. */ private static final AtomicInteger nextStorageId = new AtomicInteger(); + /** Storage IDs current assigned to the storage. */ private static final Set currentStorageIds = Collections.newSetFromMap(new ConcurrentHashMap<>()); - protected final Map storages = new HashMap<>(); - protected final Map sharedContexts = new HashMap<>(); - protected final Set pools = new HashSet<>(); + protected final Map storages = new ConcurrentHashMap<>(); + protected final Map sharedContexts = new ConcurrentHashMap<>(); + protected final Set pools = + Collections.newSetFromMap(new ConcurrentHashMap<>()); protected final OrientDBConfig configurations; protected final String basePath; protected final OEngine memory; @@ -279,7 +281,7 @@ private synchronized void checkAndCloseStorages(long delay) { Set toClose = new HashSet<>(); for (OAbstractPaginatedStorage storage : storages.values()) { if (storage.getType().equalsIgnoreCase(ODatabaseType.PLOCAL.name()) - && storage.getSessionCount() == 0) { + && storage.getSessionsCount() == 0) { long currentTime = System.currentTimeMillis(); if (currentTime > storage.getLastCloseTime() + delay) { toClose.add(storage.getName()); @@ -420,7 +422,6 @@ public ODatabaseDocumentEmbedded openNoAuthenticate(String name, String user) { synchronized (this) { checkOpen(); OAbstractPaginatedStorage storage = getAndOpenStorage(name, config); - storage.incOnOpen(); embedded = newSessionInstance(storage, config, getOrCreateSharedContext(storage)); } embedded.rebuildIndexes(); @@ -455,7 +456,6 @@ public ODatabaseDocumentEmbedded openNoAuthorization(String name) { synchronized (this) { checkOpen(); OAbstractPaginatedStorage storage = getAndOpenStorage(name, config); - storage.incOnOpen(); embedded = newSessionInstance(storage, config, getOrCreateSharedContext(storage)); } embedded.rebuildIndexes(); @@ -480,8 +480,6 @@ public ODatabaseDocumentInternal open( OAbstractPaginatedStorage storage = getAndOpenStorage(name, config); embedded = newSessionInstance(storage, config, getOrCreateSharedContext(storage)); - - storage.incOnOpen(); } embedded.rebuildIndexes(); embedded.internalOpen(user, password); @@ -507,7 +505,6 @@ public ODatabaseDocumentInternal open( String database = authenticationInfo.getDatabase().get(); OAbstractPaginatedStorage storage = getAndOpenStorage(database, config); embedded = newSessionInstance(storage, config, getOrCreateSharedContext(storage)); - storage.incOnOpen(); } embedded.rebuildIndexes(); embedded.internalOpen(authenticationInfo); @@ -547,7 +544,8 @@ private void checkDefaultPassword(String database, String user, String password) .warnNoDb( this, String.format( - "IMPORTANT! Using default password is unsafe, please change password for user '%s' on database '%s'", + "IMPORTANT! Using default password is unsafe, please change password for user" + + " '%s' on database '%s'", user, database)); } } @@ -570,7 +568,6 @@ public ODatabaseDocumentInternal poolOpen( checkOpen(); OAbstractPaginatedStorage storage = getAndOpenStorage(name, pool.getConfig()); embedded = newPooledSessionInstance(pool, storage, getOrCreateSharedContext(storage)); - storage.incOnOpen(); } embedded.rebuildIndexes(); embedded.internalOpen(user, password); @@ -693,9 +690,10 @@ public void create( throw OException.wrapException( new ODatabaseException("Cannot create database '" + name + "'"), e); } - } else + } else { throw new ODatabaseException( "Cannot create new database '" + name + "' because it already exists"); + } } embedded.callOnCreateListeners(); ODatabaseRecordThreadLocal.instance().remove(); @@ -772,9 +770,10 @@ public void restore( throw OException.wrapException( new ODatabaseException("Cannot restore database '" + name + "'"), e); } - } else + } else { throw new ODatabaseException( "Cannot create new storage '" + name + "' because it already exists"); + } } storage.restoreFromIncrementalBackup(path); embedded.callOnCreateListeners(); @@ -842,7 +841,9 @@ public synchronized boolean exists(String name, String user, String password) { if (storage == null) { if (basePath != null) { return OLocalPaginatedStorage.exists(Paths.get(buildName(name))); - } else return false; + } else { + return false; + } } return storage.exists(); } @@ -886,6 +887,7 @@ public void drop(String name, String user, String password) { } protected interface DatabaseFound { + void found(String name); } @@ -952,7 +954,9 @@ public ODatabasePoolInternal cachedPool( @Override public void close() { - if (!open) return; + if (!open) { + return; + } timeoutChecker.close(); timer.cancel(); securitySystem.shutdown(); @@ -986,12 +990,16 @@ public void close() { } public synchronized void preClose() { - if (!open) return; + if (!open) { + return; + } this.sharedContexts.values().forEach(x -> x.getViewManager().close()); } public synchronized void internalClose() { - if (!open) return; + if (!open) { + return; + } open = false; this.sharedContexts.values().forEach(x -> x.close()); final List storagesCopy = new ArrayList<>(storages.values()); @@ -1034,7 +1042,7 @@ public void removePool(ODatabasePoolInternal pool) { private static void scanDatabaseDirectory(final File directory, DatabaseFound found) { if (directory.exists() && directory.isDirectory()) { final File[] files = directory.listFiles(); - if (files != null) + if (files != null) { for (File db : files) { if (db.isDirectory()) { for (File cf : db.listFiles()) { @@ -1049,6 +1057,7 @@ private static void scanDatabaseDirectory(final File directory, DatabaseFound fo } } } + } } } @@ -1095,13 +1104,16 @@ public synchronized void forceDatabaseClose(String iDatabaseName) { public String getDatabasePath(String iDatabaseName) { OAbstractPaginatedStorage storage = storages.get(iDatabaseName); - if (storage != null && storage instanceof OLocalPaginatedStorage) + if (storage != null && storage instanceof OLocalPaginatedStorage) { return ((OLocalPaginatedStorage) storage).getStoragePath().toString(); + } return null; } protected void checkOpen() { - if (!open) throw new ODatabaseException("OrientDB Instance is closed"); + if (!open) { + throw new ODatabaseException("OrientDB Instance is closed"); + } } public boolean isOpen() { diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/OrientDBInternal.java b/core/src/main/java/com/orientechnologies/orient/core/db/OrientDBInternal.java index 120101f461b..71a406a0b94 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/db/OrientDBInternal.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/OrientDBInternal.java @@ -72,6 +72,7 @@ default OrientDB newOrientDBNoClose() { public void close() {} }; } + /** * Create a new remote factory * diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/document/LatestVersionRecordReader.java b/core/src/main/java/com/orientechnologies/orient/core/db/document/LatestVersionRecordReader.java index 544b5d704c2..a5fe46614b7 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/db/document/LatestVersionRecordReader.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/document/LatestVersionRecordReader.java @@ -5,7 +5,9 @@ import com.orientechnologies.orient.core.storage.ORawBuffer; import com.orientechnologies.orient.core.storage.OStorage; -/** @Internal */ +/** + * @Internal + */ public final class LatestVersionRecordReader implements RecordReader { @Override public ORawBuffer readRecord( diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/document/ODatabaseDocumentAbstract.java b/core/src/main/java/com/orientechnologies/orient/core/db/document/ODatabaseDocumentAbstract.java index d096c009a36..616f905b3e2 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/db/document/ODatabaseDocumentAbstract.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/document/ODatabaseDocumentAbstract.java @@ -1630,7 +1630,8 @@ protected void beforeCommitOperations() { OLogManager.instance() .error( this, - "Cannot commit the transaction: caught exception on execution of %s.onBeforeTxCommit() `%08X`", + "Cannot commit the transaction: caught exception on execution of" + + " %s.onBeforeTxCommit() `%08X`", e, listener.getClass().getName(), System.identityHashCode(e)); @@ -1649,7 +1650,8 @@ protected void afterCommitOperations() { listener.onAfterTxCommit(this); } catch (Exception e) { final String message = - "Error after the transaction has been committed. The transaction remains valid. The exception caught was on execution of " + "Error after the transaction has been committed. The transaction remains valid. The" + + " exception caught was on execution of " + listener.getClass() + ".onAfterTxCommit() `%08X`"; @@ -1978,7 +1980,8 @@ public synchronized void queryStarted(String id, OQueryDatabaseState state) { msg.append("This database instance has "); msg.append(activeQueries.size()); msg.append( - " open command/query result sets, please make sure you close them with OResultSet.close()"); + " open command/query result sets, please make sure you close them with" + + " OResultSet.close()"); OLogManager.instance().warn(this, msg.toString(), null); if (OLogManager.instance().isDebugEnabled()) { activeQueries.values().stream() diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/document/ODatabaseDocumentEmbedded.java b/core/src/main/java/com/orientechnologies/orient/core/db/document/ODatabaseDocumentEmbedded.java index 52da5a7b77f..38456c1a695 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/db/document/ODatabaseDocumentEmbedded.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/document/ODatabaseDocumentEmbedded.java @@ -524,8 +524,9 @@ public void drop() { * thread without affecting current instance. The database copy is not set in thread local. */ public ODatabaseDocumentInternal copy() { - ODatabaseDocumentEmbedded database = - new ODatabaseDocumentEmbedded((OStorage) getSharedContext().getStorage()); + var storage = (OStorage) getSharedContext().getStorage(); + storage.open(null, null, config.getConfigurations()); + ODatabaseDocumentEmbedded database = new ODatabaseDocumentEmbedded(storage); database.init(config, this.sharedContext); String user; if (getUser() != null) { @@ -533,6 +534,7 @@ public ODatabaseDocumentInternal copy() { } else { user = null; } + database.internalOpen(user, null, false); database.callOnOpenListeners(); this.activateOnCurrentThread(); @@ -873,7 +875,8 @@ public void executeDeleteRecord( if (rid == null) throw new ODatabaseException( - "Cannot delete record because it has no identity. Probably was created from scratch or contains projections of fields rather than a full record"); + "Cannot delete record because it has no identity. Probably was created from scratch or" + + " contains projections of fields rather than a full record"); if (!rid.isValid()) return; @@ -1834,7 +1837,8 @@ public void freeze(final boolean throwException) { OLogManager.instance() .error( this, - "Only local paginated storage supports freeze. If you are using remote client please use OServerAdmin instead", + "Only local paginated storage supports freeze. If you are using remote client please" + + " use OServerAdmin instead", null); return; @@ -1867,7 +1871,8 @@ public void release() { OLogManager.instance() .error( this, - "Only local paginated storage supports release. If you are using remote client please use OServerAdmin instead", + "Only local paginated storage supports release. If you are using remote client please" + + " use OServerAdmin instead", null); return; } diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/document/ODatabaseDocumentTx.java b/core/src/main/java/com/orientechnologies/orient/core/db/document/ODatabaseDocumentTx.java index 5177d5ac210..e8957aa830e 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/db/document/ODatabaseDocumentTx.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/document/ODatabaseDocumentTx.java @@ -64,6 +64,8 @@ import java.util.Map.Entry; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicReference; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; /** Created by tglman on 20/07/16. @Deprecated use {@link OrientDB} instead. */ @Deprecated @@ -72,6 +74,9 @@ public class ODatabaseDocumentTx implements ODatabaseDocumentInternal { protected static ConcurrentMap embedded = new ConcurrentHashMap<>(); protected static ConcurrentMap remote = new ConcurrentHashMap<>(); + protected static final Lock embeddedLock = new ReentrantLock(); + protected static final Lock remoteLock = new ReentrantLock(); + protected ODatabaseDocumentInternal internal; private final String url; private OrientDBInternal factory; @@ -110,37 +115,51 @@ public int getPriority() { } public static void closeAll() { - synchronized (embedded) { + embeddedLock.lock(); + try { for (OrientDBInternal factory : embedded.values()) { factory.close(); } embedded.clear(); + } finally { + embeddedLock.unlock(); } - synchronized (remote) { + + remoteLock.lock(); + try { for (OrientDBInternal factory : remote.values()) { factory.close(); } remote.clear(); + } finally { + remoteLock.unlock(); } } protected static OrientDBInternal getOrCreateRemoteFactory(String baseUrl) { OrientDBInternal factory; - synchronized (remote) { + + remoteLock.lock(); + try { factory = remote.get(baseUrl); if (factory == null || !factory.isOpen()) { factory = OrientDBInternal.fromUrl("remote:" + baseUrl, null); remote.put(baseUrl, factory); } + } finally { + remoteLock.unlock(); } return factory; } protected static OrientDBInternal getOrCreateEmbeddedFactory( String baseUrl, OrientDBConfig config) { - if (!baseUrl.endsWith("/")) baseUrl += "/"; + if (!baseUrl.endsWith("/")) { + baseUrl += "/"; + } OrientDBInternal factory; - synchronized (embedded) { + embeddedLock.lock(); + try { factory = embedded.get(baseUrl); if (factory == null || !factory.isOpen()) { try { @@ -150,11 +169,16 @@ protected static OrientDBInternal getOrCreateEmbeddedFactory( } embedded.put(baseUrl, factory); } + } finally { + embeddedLock.unlock(); } + return factory; } - /** @Deprecated use {{@link OrientDB}} instead. */ + /** + * @Deprecated use {{@link OrientDB}} instead. + */ @Deprecated public ODatabaseDocumentTx(String url) { this(url, true); @@ -189,13 +213,17 @@ public static void setDefaultSerializer(ORecordSerializer defaultSerializer) { @Override public OCurrentStorageComponentsFactory getStorageVersions() { - if (internal == null) return null; + if (internal == null) { + return null; + } return internal.getStorageVersions(); } @Override public OSBTreeCollectionManager getSbTreeCollectionManager() { - if (internal == null) return null; + if (internal == null) { + return null; + } return internal.getSbTreeCollectionManager(); } @@ -208,7 +236,9 @@ public OBinarySerializerFactory getSerializerFactory() { @Override public ORecordSerializer getSerializer() { if (internal == null) { - if (serializer != null) return serializer; + if (serializer != null) { + return serializer; + } return ORecordSerializerFactory.instance().getDefaultRecordSerializer(); } return internal.getSerializer(); @@ -378,7 +408,9 @@ public void checkIfActive() { } protected void checkOpenness() { - if (internal == null) throw new ODatabaseException("Database '" + getURL() + "' is closed"); + if (internal == null) { + throw new ODatabaseException("Database '" + getURL() + "' is closed"); + } } @Override @@ -396,7 +428,9 @@ public void callOnCloseListeners() { @Override @Deprecated public OStorage getStorage() { - if (internal == null) return delegateStorage; + if (internal == null) { + return delegateStorage; + } return internal.getStorage(); } @@ -412,23 +446,30 @@ public void replaceStorage(OStorage iNewStorage) { @Override public void resetInitialization() { - if (internal != null) internal.resetInitialization(); + if (internal != null) { + internal.resetInitialization(); + } } @Override public ODatabaseInternal getDatabaseOwner() { ODatabaseInternal current = databaseOwner; - while (current != null && current != this && current.getDatabaseOwner() != current) + while (current != null && current != this && current.getDatabaseOwner() != current) { current = current.getDatabaseOwner(); - if (current == null) return this; + } + if (current == null) { + return this; + } return current; } @Override public ODatabaseInternal setDatabaseOwner(ODatabaseInternal iOwner) { databaseOwner = iOwner; - if (internal != null) internal.setDatabaseOwner(iOwner); + if (internal != null) { + internal.setDatabaseOwner(iOwner); + } return this; } @@ -557,7 +598,9 @@ public ODictionary getDictionary() { @Override public OSecurityUser getUser() { - if (internal != null) return internal.getUser(); + if (internal != null) { + return internal.getUser(); + } return null; } @@ -898,11 +941,18 @@ public DB open(String iUserName, String iUserPassword) { OrientDBConfig config = buildConfig(null); internal = factory.open(dbName, iUserName, iUserPassword, config); } - if (databaseOwner != null) internal.setDatabaseOwner(databaseOwner); - if (conflictStrategy != null) internal.setConflictStrategy(conflictStrategy); - if (serializer != null) internal.setSerializer(serializer); - for (Entry pro : preopenProperties.entrySet()) + if (databaseOwner != null) { + internal.setDatabaseOwner(databaseOwner); + } + if (conflictStrategy != null) { + internal.setConflictStrategy(conflictStrategy); + } + if (serializer != null) { + internal.setSerializer(serializer); + } + for (Entry pro : preopenProperties.entrySet()) { internal.setProperty(pro.getKey(), pro.getValue()); + } } catch (RuntimeException e) { clearOwner(); throw e; @@ -911,7 +961,9 @@ public DB open(String iUserName, String iUserPassword) { } protected void setupThreadOwner() { - if (!ownerProtection) return; + if (!ownerProtection) { + return; + } final Thread current = Thread.currentThread(); final Thread o = owner.get(); @@ -923,7 +975,9 @@ protected void setupThreadOwner() { } protected void clearOwner() { - if (!ownerProtection) return; + if (!ownerProtection) { + return; + } owner.set(null); } @@ -973,11 +1027,18 @@ public DB create(Map iIniti internal.registerListener(oDatabaseListener); } } - if (databaseOwner != null) internal.setDatabaseOwner(databaseOwner); - if (conflictStrategy != null) internal.setConflictStrategy(conflictStrategy); - if (serializer != null) internal.setSerializer(serializer); - for (Entry pro : preopenProperties.entrySet()) + if (databaseOwner != null) { + internal.setDatabaseOwner(databaseOwner); + } + if (conflictStrategy != null) { + internal.setConflictStrategy(conflictStrategy); + } + if (serializer != null) { + internal.setSerializer(serializer); + } + for (Entry pro : preopenProperties.entrySet()) { internal.setProperty(pro.getKey(), pro.getValue()); + } } catch (RuntimeException e) { clearOwner(); throw e; @@ -987,13 +1048,17 @@ public DB create(Map iIniti @Override public ODatabase activateOnCurrentThread() { - if (internal != null) internal.activateOnCurrentThread(); + if (internal != null) { + internal.activateOnCurrentThread(); + } return this; } @Override public boolean isActiveOnCurrentThread() { - if (internal != null) return internal.isActiveOnCurrentThread(); + if (internal != null) { + return internal.isActiveOnCurrentThread(); + } return false; } @@ -1021,8 +1086,9 @@ public OContextConfiguration getConfiguration() { @Override public boolean declareIntent(OIntent iIntent) { - if (internal != null) return internal.declareIntent(iIntent); - else { + if (internal != null) { + return internal.declareIntent(iIntent); + } else { intent = iIntent; return true; } @@ -1030,13 +1096,17 @@ public boolean declareIntent(OIntent iIntent) { @Override public OIntent getActiveIntent() { - if (internal == null) return intent; + if (internal == null) { + return intent; + } return internal.getActiveIntent(); } @Override public boolean exists() { - if (internal != null) return true; + if (internal != null) { + return true; + } if ("remote".equals(type)) { throw new UnsupportedOperationException(); } else { @@ -1216,14 +1286,20 @@ public boolean dropCluster(int iClusterId) { @Override public Object setProperty(String iName, Object iValue) { - if (internal != null) return internal.setProperty(iName, iValue); - else return preopenProperties.put(iName, iValue); + if (internal != null) { + return internal.setProperty(iName, iValue); + } else { + return preopenProperties.put(iName, iValue); + } } @Override public Object getProperty(String iName) { - if (internal != null) return internal.getProperty(iName); - else return preopenProperties.get(iName); + if (internal != null) { + return internal.getProperty(iName); + } else { + return preopenProperties.get(iName); + } } @Override @@ -1243,8 +1319,11 @@ public Object get(ATTRIBUTES iAttribute) { @Override public DB set(ATTRIBUTES iAttribute, Object iValue) { - if (internal != null) internal.set(iAttribute, iValue); - else preopenAttributes.put(iAttribute, iValue); + if (internal != null) { + internal.set(iAttribute, iValue); + } else { + preopenAttributes.put(iAttribute, iValue); + } return (DB) this; } @@ -1370,32 +1449,39 @@ private OrientDBConfig buildConfig(final Map iProp pars != null ? (String) pars.get(OGlobalConfiguration.CLIENT_CONNECTION_STRATEGY.getKey()) : null; - if (connectionStrategy != null) + if (connectionStrategy != null) { builder.addConfig(OGlobalConfiguration.CLIENT_CONNECTION_STRATEGY, connectionStrategy); + } final String compressionMethod = pars != null ? (String) pars.get(OGlobalConfiguration.STORAGE_COMPRESSION_METHOD.getKey()) : null; if (compressionMethod != null) - // SAVE COMPRESSION METHOD IN CONFIGURATION + // SAVE COMPRESSION METHOD IN CONFIGURATION + { builder.addConfig(OGlobalConfiguration.STORAGE_COMPRESSION_METHOD, compressionMethod); + } final String encryptionMethod = pars != null ? (String) pars.get(OGlobalConfiguration.STORAGE_ENCRYPTION_METHOD.getKey()) : null; if (encryptionMethod != null) - // SAVE ENCRYPTION METHOD IN CONFIGURATION + // SAVE ENCRYPTION METHOD IN CONFIGURATION + { builder.addConfig(OGlobalConfiguration.STORAGE_ENCRYPTION_METHOD, encryptionMethod); + } final String encryptionKey = pars != null ? (String) pars.get(OGlobalConfiguration.STORAGE_ENCRYPTION_KEY.getKey()) : null; if (encryptionKey != null) - // SAVE ENCRYPTION KEY IN CONFIGURATION + // SAVE ENCRYPTION KEY IN CONFIGURATION + { builder.addConfig(OGlobalConfiguration.STORAGE_ENCRYPTION_KEY, encryptionKey); + } for (Map.Entry attr : preopenAttributes.entrySet()) { builder.addAttribute(attr.getKey(), attr.getValue()); diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/document/ODatabaseDocumentTxInternal.java b/core/src/main/java/com/orientechnologies/orient/core/db/document/ODatabaseDocumentTxInternal.java index d8ea5668a4e..6c40cfb6789 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/db/document/ODatabaseDocumentTxInternal.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/document/ODatabaseDocumentTxInternal.java @@ -10,7 +10,9 @@ public class ODatabaseDocumentTxInternal { private ODatabaseDocumentTxInternal() {} public static ODatabaseDocumentInternal getInternal(ODatabaseDocumentInternal db) { - if (db instanceof ODatabaseDocumentTx) db = ((ODatabaseDocumentTx) db).internal; + if (db instanceof ODatabaseDocumentTx) { + db = ((ODatabaseDocumentTx) db).internal; + } return db; } @@ -28,14 +30,21 @@ public static OrientDBInternal getOrCreateRemoteFactory(String url) { } public static void closeAllOnShutdown() { - synchronized (ODatabaseDocumentTx.embedded) { + ODatabaseDocumentTx.embeddedLock.lock(); + try { for (OrientDBInternal factory : ODatabaseDocumentTx.embedded.values()) { factory.internalClose(); } ODatabaseDocumentTx.embedded.clear(); + } finally { + ODatabaseDocumentTx.embeddedLock.unlock(); } - synchronized (ODatabaseDocumentTx.remote) { + + ODatabaseDocumentTx.remoteLock.lock(); + try { ODatabaseDocumentTx.remote.clear(); + } finally { + ODatabaseDocumentTx.remoteLock.unlock(); } } } diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/document/ODatabaseDocumentTxPooled.java b/core/src/main/java/com/orientechnologies/orient/core/db/document/ODatabaseDocumentTxPooled.java index 4dbe16fd145..e615929fdd7 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/db/document/ODatabaseDocumentTxPooled.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/document/ODatabaseDocumentTxPooled.java @@ -69,25 +69,33 @@ public void reuse(final Object iOwner, final Object[] iAdditionalArgs) { @Override public ODatabaseDocumentTxPooled open(final String iUserName, final String iUserPassword) { throw new UnsupportedOperationException( - "Database instance was retrieved from a pool. You cannot open the database in this way. Use directly a ODatabaseDocumentTx instance if you want to manually open the connection"); + "Database instance was retrieved from a pool. You cannot open the database in this way. Use" + + " directly a ODatabaseDocumentTx instance if you want to manually open the" + + " connection"); } @Override public ODatabaseDocumentTxPooled open(final OToken iToken) { throw new UnsupportedOperationException( - "Database instance was retrieved from a pool. You cannot open the database in this way. Use directly a ODatabaseDocumentTx instance if you want to manually open the connection"); + "Database instance was retrieved from a pool. You cannot open the database in this way. Use" + + " directly a ODatabaseDocumentTx instance if you want to manually open the" + + " connection"); } @Override public ODatabaseDocumentTxPooled create() { throw new UnsupportedOperationException( - "Database instance was retrieved from a pool. You cannot open the database in this way. Use directly a ODatabaseDocumentTx instance if you want to manually open the connection"); + "Database instance was retrieved from a pool. You cannot open the database in this way. Use" + + " directly a ODatabaseDocumentTx instance if you want to manually open the" + + " connection"); } @Override public DB create(String incrementalBackupPath) { throw new UnsupportedOperationException( - "Database instance was retrieved from a pool. You cannot open the database in this way. Use directly a ODatabaseDocumentTx instance if you want to manually open the connection"); + "Database instance was retrieved from a pool. You cannot open the database in this way. Use" + + " directly a ODatabaseDocumentTx instance if you want to manually open the" + + " connection"); } public boolean isUnderlyingOpen() { @@ -151,7 +159,8 @@ public void forceClose() { protected void checkOpenness() { if (ownerPool == null) throw new ODatabaseException( - "Database instance has been released to the pool. Get another database instance from the pool with the right username and password"); + "Database instance has been released to the pool. Get another database instance from the" + + " pool with the right username and password"); // super.checkOpenness(); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/document/RecordReader.java b/core/src/main/java/com/orientechnologies/orient/core/db/document/RecordReader.java index 8cb2b9dc6c5..4ccadfd9a2a 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/db/document/RecordReader.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/document/RecordReader.java @@ -5,7 +5,9 @@ import com.orientechnologies.orient.core.storage.ORawBuffer; import com.orientechnologies.orient.core.storage.OStorage; -/** @Internal */ +/** + * @Internal + */ public interface RecordReader { ORawBuffer readRecord( OStorage storage, diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/document/SimpleRecordReader.java b/core/src/main/java/com/orientechnologies/orient/core/db/document/SimpleRecordReader.java index 66c41926c58..ebceb29abad 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/db/document/SimpleRecordReader.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/document/SimpleRecordReader.java @@ -5,7 +5,9 @@ import com.orientechnologies.orient.core.storage.ORawBuffer; import com.orientechnologies.orient.core.storage.OStorage; -/** @Internal */ +/** + * @Internal + */ public final class SimpleRecordReader implements RecordReader { private final boolean prefetchRecords; diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/record/ORecordElement.java b/core/src/main/java/com/orientechnologies/orient/core/db/record/ORecordElement.java index 3da5eab611c..c62503a5ce0 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/db/record/ORecordElement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/record/ORecordElement.java @@ -43,6 +43,8 @@ enum STATUS { void setDirtyNoChanged(); - /** @return Returns record element which contains given one. */ + /** + * @return Returns record element which contains given one. + */ ORecordElement getOwner(); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/record/ORecordLazyList.java b/core/src/main/java/com/orientechnologies/orient/core/db/record/ORecordLazyList.java index ba7630e5c9e..0a79368c07f 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/db/record/ORecordLazyList.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/record/ORecordLazyList.java @@ -94,7 +94,9 @@ public boolean isEmpty() { return super.isEmpty(); } - /** @return iterator that just returns the elements without conversion. */ + /** + * @return iterator that just returns the elements without conversion. + */ public Iterator rawIterator() { lazyLoad(false); final Iterator subIterator = diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/record/ridbag/embedded/OEmbeddedRidBag.java b/core/src/main/java/com/orientechnologies/orient/core/db/record/ridbag/embedded/OEmbeddedRidBag.java index 2057ec03bc5..794038bb7e9 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/db/record/ridbag/embedded/OEmbeddedRidBag.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/record/ridbag/embedded/OEmbeddedRidBag.java @@ -213,7 +213,8 @@ public void setOwner(ORecordElement owner) { throw new IllegalStateException( "This data structure is owned by document " + owner - + " if you want to use it in other document create new rid bag instance and copy content of current one."); + + " if you want to use it in other document create new rid bag instance and copy" + + " content of current one."); } if (this.owner != null) { for (int i = 0; i < entriesLength; i++) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/tool/OCheckIndexTool.java b/core/src/main/java/com/orientechnologies/orient/core/db/tool/OCheckIndexTool.java index 7cdbdc63799..644c0e267cd 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/db/tool/OCheckIndexTool.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/tool/OCheckIndexTool.java @@ -31,7 +31,9 @@ import java.util.List; import java.util.stream.Stream; -/** @author Luigi Dell'Aquila (l.dellaquila -at- orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila -at- orientdb.com) + */ public class OCheckIndexTool extends ODatabaseTool { // class Error { diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/tool/ODatabaseCompare.java b/core/src/main/java/com/orientechnologies/orient/core/db/tool/ODatabaseCompare.java index 475258e5f14..88e5f0e2123 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/db/tool/ODatabaseCompare.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/tool/ODatabaseCompare.java @@ -128,7 +128,9 @@ public boolean compare() { ODocumentHelper.RIDMapper ridMapper = null; if (autoDetectExportImportMap) { listener.onMessage( - "\nAuto discovery of mapping between RIDs of exported and imported records is switched on, try to discover mapping data on disk."); + "\n" + + "Auto discovery of mapping between RIDs of exported and imported records is" + + " switched on, try to discover mapping data on disk."); if (databaseTwo.getMetadata().getSchema().getClass(ODatabaseImport.EXPORT_IMPORT_CLASS_NAME) != null) { listener.onMessage("\nMapping data were found and will be loaded."); diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/tool/ODatabaseExport.java b/core/src/main/java/com/orientechnologies/orient/core/db/tool/ODatabaseExport.java index e3d8931ae15..5e4d6ed7be6 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/db/tool/ODatabaseExport.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/tool/ODatabaseExport.java @@ -264,7 +264,12 @@ private long exportRecords() throws IOException { OLogManager.instance() .error( this, - "\nError on exporting record %s. It seems corrupted; size: %d bytes, raw content (as string):\n==========\n%s\n==========", + "\n" + + "Error on exporting record %s. It seems corrupted; size: %d bytes, raw" + + " content (as string):\n" + + "==========\n" + + "%s\n" + + "==========", t, rec.getIdentity(), buffer.length, @@ -661,7 +666,12 @@ private boolean exportRecord(long recordTot, long recordNum, ORecord rec, Set brokenRids) throws IOException, ParseException { if (exporterVersion >= 12) { listener.onMessage( - "Reading of set of RIDs of records which were detected as broken during database export\n"); + "Reading of set of RIDs of records which were detected as broken during database" + + " export\n"); jsonReader.readNext(OJSONReader.BEGIN_COLLECTION); while (true) { @@ -306,8 +307,8 @@ private void processBrokenRids(final Set brokenRids) throws IOException, P if (exporterVersion >= 12) listener.onMessage( brokenRids.size() - + " were detected as broken during database export, links on those records will be removed from" - + " result database"); + + " were detected as broken during database export, links on those records will be" + + " removed from result database"); migrateLinksInImportedDocuments(brokenRids); } } @@ -1424,8 +1425,9 @@ private long importRecords() throws Exception { listener.onMessage( String.format( - "\n- Imported %,d records into clusters: %s. " - + "Total JSON records imported so for %,d .Total records imported so far: %,d (%,.2f/sec)", + "\n" + + "- Imported %,d records into clusters: %s. Total JSON records imported so for" + + " %,d .Total records imported so far: %,d (%,.2f/sec)", lastLapRecords, total, sortedClusters.size(), @@ -1714,7 +1716,9 @@ private OIndexDefinition importIndexDefinition() throws IOException, ParseExcept private void migrateLinksInImportedDocuments(Set brokenRids) throws IOException { listener.onMessage( - "\n\nStarted migration of links (-migrateLinks=true). Links are going to be updated according to new RIDs:"); + "\n\n" + + "Started migration of links (-migrateLinks=true). Links are going to be updated" + + " according to new RIDs:"); final long begin = System.currentTimeMillis(); long last = begin; diff --git a/core/src/main/java/com/orientechnologies/orient/core/encryption/impl/OAESEncryption.java b/core/src/main/java/com/orientechnologies/orient/core/encryption/impl/OAESEncryption.java index 8e941b89d84..e49dd2e8e57 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/encryption/impl/OAESEncryption.java +++ b/core/src/main/java/com/orientechnologies/orient/core/encryption/impl/OAESEncryption.java @@ -43,7 +43,8 @@ public OEncryption configure(final String iOptions) { if (iOptions == null) throw new OSecurityException( - "AES encryption has been selected, but no key was found. Please configure it by passing the key as property at database create/open. The property key is: '" + "AES encryption has been selected, but no key was found. Please configure it by passing" + + " the key as property at database create/open. The property key is: '" + OGlobalConfiguration.STORAGE_ENCRYPTION_KEY.getKey() + "'"); @@ -55,7 +56,8 @@ public OEncryption configure(final String iOptions) { } catch (Exception e) { throw OException.wrapException( new OInvalidStorageEncryptionKeyException( - "Cannot initialize AES encryption with current key. Assure the key is a BASE64 - 128 oe 256 bits long"), + "Cannot initialize AES encryption with current key. Assure the key is a BASE64 - 128" + + " oe 256 bits long"), e); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/encryption/impl/OAESGCMEncryption.java b/core/src/main/java/com/orientechnologies/orient/core/encryption/impl/OAESGCMEncryption.java index 89ca6260b37..44f568f97d9 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/encryption/impl/OAESGCMEncryption.java +++ b/core/src/main/java/com/orientechnologies/orient/core/encryption/impl/OAESGCMEncryption.java @@ -50,20 +50,23 @@ public class OAESGCMEncryption implements OEncryption { private static final String NO_SUCH_CIPHER = "AES/GCM/NoPadding not supported."; private static final String MISSING_KEY_ERROR = - "AESGCMEncryption encryption has been selected, " - + "but no key was found. Please configure it by passing the key as property at database create/open. The property key is: '%s'"; + "AESGCMEncryption encryption has been selected, but no key was found. Please configure it by" + + " passing the key as property at database create/open. The property key is: '%s'"; private static final String INVALID_KEY_ERROR = - "Failed to initialize AESGCMEncryption. Assure the key is a 128, 192 or 256 bits long BASE64 value"; + "Failed to initialize AESGCMEncryption. Assure the key is a 128, 192 or 256 bits long BASE64" + + " value"; private static final String ENCRYPTION_NOT_INITIALIZED_ERROR = "OAESGCMEncryption not properly initialized"; private static final String AUTHENTICATION_ERROR = - "Authentication of encrypted data failed. The encrypted data may have been altered or the used key is incorrect"; + "Authentication of encrypted data failed. The encrypted data may have been altered or the" + + " used key is incorrect"; private static final String INVALID_CIPHERTEXT_SIZE_ERROR = "Invalid ciphertext size: minimum: %d, actual: %d"; private static final String INVALID_RANGE_ERROR = "Invalid range: array size: %d, offset: %d, length: %d"; private static final String BLOCKING_SECURE_RANDOM_ERROR = - "SecureRandom blocked while retrieving randomness. This maybe caused by a misconfigured or absent random source on your operating system."; + "SecureRandom blocked while retrieving randomness. This maybe caused by a misconfigured or" + + " absent random source on your operating system."; private boolean initialized; private SecretKey key; diff --git a/core/src/main/java/com/orientechnologies/orient/core/encryption/impl/ODESEncryption.java b/core/src/main/java/com/orientechnologies/orient/core/encryption/impl/ODESEncryption.java index 4bf9a507e82..08e1af88d78 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/encryption/impl/ODESEncryption.java +++ b/core/src/main/java/com/orientechnologies/orient/core/encryption/impl/ODESEncryption.java @@ -45,7 +45,8 @@ public OEncryption configure(final String iOptions) { if (iOptions == null) throw new OSecurityException( - "DES encryption has been selected, but no key was found. Please configure it by passing the key as property at database create/open. The property key is: '" + "DES encryption has been selected, but no key was found. Please configure it by passing" + + " the key as property at database create/open. The property key is: '" + OGlobalConfiguration.STORAGE_ENCRYPTION_KEY.getKey() + "'"); @@ -61,7 +62,8 @@ public OEncryption configure(final String iOptions) { } catch (Exception e) { throw OException.wrapException( new OInvalidStorageEncryptionKeyException( - "Cannot initialize DES encryption with current key. Assure the key is a BASE64 - 64 bits long"), + "Cannot initialize DES encryption with current key. Assure the key is a BASE64 - 64" + + " bits long"), e); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/engine/OMemoryAndLocalPaginatedEnginesInitializer.java b/core/src/main/java/com/orientechnologies/orient/core/engine/OMemoryAndLocalPaginatedEnginesInitializer.java index 10c810a70ec..ee8c7f852f5 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/engine/OMemoryAndLocalPaginatedEnginesInitializer.java +++ b/core/src/main/java/com/orientechnologies/orient/core/engine/OMemoryAndLocalPaginatedEnginesInitializer.java @@ -79,7 +79,8 @@ private void configureDefaultDiskCacheSize() { OLogManager.instance() .warnNoDb( this, - "Can not determine amount of memory installed on machine, default size of disk cache will be used"); + "Can not determine amount of memory installed on machine, default size of disk cache" + + " will be used"); return; } @@ -92,8 +93,8 @@ private void configureDefaultDiskCacheSize() { OLogManager.instance() .infoNoDb( this, - "Because OrientDB is running inside a container %s of memory will be left unallocated according to the setting '%s'" - + " not taking into account heap memory", + "Because OrientDB is running inside a container %s of memory will be left unallocated" + + " according to the setting '%s' not taking into account heap memory", OGlobalConfiguration.MEMORY_LEFT_TO_CONTAINER.getValueAsString(), OGlobalConfiguration.MEMORY_LEFT_TO_CONTAINER.getKey()); @@ -138,8 +139,9 @@ private void configureDefaultDiskCacheSize() { OLogManager.instance() .warnNoDb( null, - "Not enough physical memory available for DISKCACHE: %,dMB (heap=%,dMB). Set lower Maximum Heap (-Xmx " - + "setting on JVM) and restart OrientDB. Now running with DISKCACHE=" + "Not enough physical memory available for DISKCACHE: %,dMB (heap=%,dMB). Set lower" + + " Maximum Heap (-Xmx setting on JVM) and restart OrientDB. Now running with" + + " DISKCACHE=" + diskCacheInMB + "MB", osMemory.memoryLimit / 1024 / 1024, diff --git a/core/src/main/java/com/orientechnologies/orient/core/engine/local/OEngineLocalPaginated.java b/core/src/main/java/com/orientechnologies/orient/core/engine/local/OEngineLocalPaginated.java index 421997aff04..b71c31e9239 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/engine/local/OEngineLocalPaginated.java +++ b/core/src/main/java/com/orientechnologies/orient/core/engine/local/OEngineLocalPaginated.java @@ -80,8 +80,9 @@ public void startup() { OLogManager.instance() .warnNoDb( this, - "You are running under the \"root\" user privileges that introduces security risks. " - + "Please consider to run under a user dedicated to be used to run current server instance."); + "You are running under the \"root\" user privileges that introduces security risks." + + " Please consider to run under a user dedicated to be used to run current" + + " server instance."); } OMemoryAndLocalPaginatedEnginesInitializer.INSTANCE.initialize(); diff --git a/core/src/main/java/com/orientechnologies/orient/core/exception/OFetchException.java b/core/src/main/java/com/orientechnologies/orient/core/exception/OFetchException.java index cfe393f4e0d..7e0780236c7 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/exception/OFetchException.java +++ b/core/src/main/java/com/orientechnologies/orient/core/exception/OFetchException.java @@ -16,7 +16,9 @@ */ package com.orientechnologies.orient.core.exception; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OFetchException extends OCoreException { private static final long serialVersionUID = 7247597939953323863L; diff --git a/core/src/main/java/com/orientechnologies/orient/core/fetch/OFetchContext.java b/core/src/main/java/com/orientechnologies/orient/core/fetch/OFetchContext.java index f3ef4d0497e..ec62599a791 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/fetch/OFetchContext.java +++ b/core/src/main/java/com/orientechnologies/orient/core/fetch/OFetchContext.java @@ -21,7 +21,9 @@ import com.orientechnologies.orient.core.metadata.schema.OType; import com.orientechnologies.orient.core.record.impl.ODocument; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public interface OFetchContext { void onBeforeFetch(final ODocument iRootRecord) throws OFetchException; diff --git a/core/src/main/java/com/orientechnologies/orient/core/fetch/OFetchPlan.java b/core/src/main/java/com/orientechnologies/orient/core/fetch/OFetchPlan.java index 71593853400..f42c6551e40 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/fetch/OFetchPlan.java +++ b/core/src/main/java/com/orientechnologies/orient/core/fetch/OFetchPlan.java @@ -74,7 +74,8 @@ public OFetchPlan(final String iFetchPlan) { if (key.indexOf(".") > -1) throw new IllegalArgumentException( - "Nested levels (fields separated by dot) are not allowed on fetch plan when dynamic depth level is specified (square brackets): " + "Nested levels (fields separated by dot) are not allowed on fetch plan when" + + " dynamic depth level is specified (square brackets): " + key); final List indexRanges = OStringSerializerHelper.smartSplit(range, '-', ' '); diff --git a/core/src/main/java/com/orientechnologies/orient/core/fetch/json/OJSONFetchContext.java b/core/src/main/java/com/orientechnologies/orient/core/fetch/json/OJSONFetchContext.java index bef1b568073..484ac4882b8 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/fetch/json/OJSONFetchContext.java +++ b/core/src/main/java/com/orientechnologies/orient/core/fetch/json/OJSONFetchContext.java @@ -37,7 +37,9 @@ import java.util.Set; import java.util.Stack; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OJSONFetchContext implements OFetchContext { protected final OJSONWriter jsonWriter; diff --git a/core/src/main/java/com/orientechnologies/orient/core/fetch/json/OJSONFetchListener.java b/core/src/main/java/com/orientechnologies/orient/core/fetch/json/OJSONFetchListener.java index 1978f8ca200..7832967dc27 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/fetch/json/OJSONFetchListener.java +++ b/core/src/main/java/com/orientechnologies/orient/core/fetch/json/OJSONFetchListener.java @@ -27,7 +27,9 @@ import com.orientechnologies.orient.core.serialization.serializer.OJSONWriter; import java.io.IOException; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OJSONFetchListener implements OFetchListener { public boolean requireFieldProcessing() { diff --git a/core/src/main/java/com/orientechnologies/orient/core/id/ORecordId.java b/core/src/main/java/com/orientechnologies/orient/core/id/ORecordId.java index 7e47154e76e..5c92de15623 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/id/ORecordId.java +++ b/core/src/main/java/com/orientechnologies/orient/core/id/ORecordId.java @@ -254,7 +254,8 @@ public void fromString(String iRecordId) { throw new IllegalArgumentException( "Argument '" + iRecordId - + "' is not a RecordId in form of string. Format must be: :"); + + "' is not a RecordId in form of string. Format must be:" + + " :"); final List parts = OStringSerializerHelper.split(iRecordId, SEPARATOR, PREFIX); @@ -262,7 +263,8 @@ public void fromString(String iRecordId) { throw new IllegalArgumentException( "Argument received '" + iRecordId - + "' is not a RecordId in form of string. Format must be: #:. Example: #3:12"); + + "' is not a RecordId in form of string. Format must be:" + + " #:. Example: #3:12"); clusterId = Integer.parseInt(parts.get(0)); checkClusterLimits(); @@ -323,7 +325,9 @@ public T getRecord() { final ODatabaseDocument db = ODatabaseRecordThreadLocal.instance().get(); if (db == null) throw new ODatabaseException( - "No database found in current thread local space. If you manually control databases over threads assure to set the current database before to use it by calling: ODatabaseRecordThreadLocal.instance().set(db);"); + "No database found in current thread local space. If you manually control databases over" + + " threads assure to set the current database before to use it by calling:" + + " ODatabaseRecordThreadLocal.instance().set(db);"); return (T) db.load(this); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OCompositeCollate.java b/core/src/main/java/com/orientechnologies/orient/core/index/OCompositeCollate.java index 0dca7c5a5ce..cb42909d580 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/OCompositeCollate.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/OCompositeCollate.java @@ -28,7 +28,9 @@ public class OCompositeCollate implements OCollate { private static final long serialVersionUID = 8683726773893639905L; private final OAbstractIndexDefinition oCompositeIndexDefinition; - /** @param oCompositeIndexDefinition */ + /** + * @param oCompositeIndexDefinition + */ public OCompositeCollate(final OAbstractIndexDefinition oCompositeIndexDefinition) { this.oCompositeIndexDefinition = oCompositeIndexDefinition; } diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OCompositeKey.java b/core/src/main/java/com/orientechnologies/orient/core/index/OCompositeKey.java index bd05f11d4b7..89c8f40b25a 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/OCompositeKey.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/OCompositeKey.java @@ -47,6 +47,7 @@ public class OCompositeKey implements Comparable, Serializable, ODocumentSerializable { private static final long serialVersionUID = 1L; + /** */ private final List keys; diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/ODefaultIndexFactory.java b/core/src/main/java/com/orientechnologies/orient/core/index/ODefaultIndexFactory.java index 1cf69ebfd5d..adb4303c04a 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/ODefaultIndexFactory.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/ODefaultIndexFactory.java @@ -118,8 +118,8 @@ public OIndexInternal createIndex(OStorage storage, OIndexMetadata im) OLogManager.instance() .warnNoDb( ODefaultIndexFactory.class, - "You are creating native full text index instance. " - + "That is unsafe because this type of index is deprecated and will be removed in future."); + "You are creating native full text index instance. That is unsafe because this type" + + " of index is deprecated and will be removed in future."); return new OIndexFullText(im, storage); } else if (OClass.INDEX_TYPE.DICTIONARY.toString().equals(indexType)) { return new OIndexDictionary(im, storage); diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexAbstract.java b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexAbstract.java index e0efc4d33bc..8a4bcf7de9e 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexAbstract.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexAbstract.java @@ -341,7 +341,9 @@ public long rebuild() { @Override public void close() {} - /** @return number of entries in the index. */ + /** + * @return number of entries in the index. + */ @Deprecated public long getSize() { return size(); @@ -356,7 +358,9 @@ public long count(Object iKey) { } } - /** @return Number of keys in index */ + /** + * @return Number of keys in index + */ @Deprecated public long getKeySize() { try (Stream stream = keyStream()) { @@ -1043,8 +1047,8 @@ protected void onIndexEngineChange(final int indexId) { public static void manualIndexesWarning() { if (!OGlobalConfiguration.INDEX_ALLOW_MANUAL_INDEXES.getValueAsBoolean()) { throw new OManualIndexesAreProhibited( - "Manual indexes are deprecated, not supported any more and will be removed in next versions if you still want to use them, " - + "please set global property `" + "Manual indexes are deprecated, not supported any more and will be removed in next" + + " versions if you still want to use them, please set global property `" + OGlobalConfiguration.INDEX_ALLOW_MANUAL_INDEXES.getKey() + "` to `true`"); } @@ -1053,9 +1057,9 @@ public static void manualIndexesWarning() { OLogManager.instance() .warn( OIndexAbstract.class, - "Seems you use manual indexes. " - + "Manual indexes are deprecated, not supported any more and will be removed in next versions if you do not want " - + "to see warning, please set global property `" + "Seems you use manual indexes. Manual indexes are deprecated, not supported any more" + + " and will be removed in next versions if you do not want to see warning," + + " please set global property `" + OGlobalConfiguration.INDEX_ALLOW_MANUAL_INDEXES_WARNING.getKey() + "` to `false`"); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexDefinition.java b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexDefinition.java index 7827e67bcae..141dfd5588b 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexDefinition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexDefinition.java @@ -47,7 +47,9 @@ public interface OIndexDefinition extends OIndexCallback { */ List getFieldsToIndex(); - /** @return Name of the class which this index belongs to. */ + /** + * @return Name of the class which this index belongs to. + */ String getClassName(); /** {@inheritDoc} */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexDefinitionFactory.java b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexDefinitionFactory.java index 5f2b1c05704..7a24cfacf86 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexDefinitionFactory.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexDefinitionFactory.java @@ -203,8 +203,8 @@ public static OIndexDefinition createSingleFieldIndexDefinition( indexType = linkedType; if (indexType == null) throw new OIndexException( - "Linked type was not provided." - + " You should provide linked type for embedded collections that are going to be indexed."); + "Linked type was not provided. You should provide linked type for embedded" + + " collections that are going to be indexed."); } } indexDefinition = new OPropertyMapIndexDefinition(className, fieldName, indexType, indexBy); @@ -219,8 +219,8 @@ else if (type.equals(OType.LINKLIST)) { indexType = linkedType; if (indexType == null) throw new OIndexException( - "Linked type was not provided." - + " You should provide linked type for embedded collections that are going to be indexed."); + "Linked type was not provided. You should provide linked type for embedded" + + " collections that are going to be indexed."); } indexDefinition = new OPropertyListIndexDefinition(className, fieldName, indexType); } else if (type.equals(OType.LINKBAG)) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexFactory.java b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexFactory.java index 60b086ecbf2..31ffc4e530b 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexFactory.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexFactory.java @@ -29,10 +29,14 @@ public interface OIndexFactory { int getLastVersion(final String algorithm); - /** @return List of supported indexes of this factory */ + /** + * @return List of supported indexes of this factory + */ Set getTypes(); - /** @return List of supported algorithms of this factory */ + /** + * @return List of supported algorithms of this factory + */ Set getAlgorithms(); /** diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexInternal.java b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexInternal.java index 4025423bf57..14fb4e70f2e 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexInternal.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexInternal.java @@ -131,7 +131,9 @@ public interface OIndexInternal extends OIndex { */ boolean acquireAtomicExclusiveLock(Object key); - /** @return number of entries in the index. */ + /** + * @return number of entries in the index. + */ long size(); Stream getRids(final Object key); diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexes.java b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexes.java index 83755d5cebc..6cbe506e4f0 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexes.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexes.java @@ -84,7 +84,9 @@ private static synchronized Set getFactories() { return FACTORIES; } - /** @return Iterator of all index factories */ + /** + * @return Iterator of all index factories + */ public static Iterator getAllFactories() { return getFactories().iterator(); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/ORecreateIndexesTask.java b/core/src/main/java/com/orientechnologies/orient/core/index/ORecreateIndexesTask.java index 6f6ceedb45d..e9def42a00e 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/index/ORecreateIndexesTask.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/ORecreateIndexesTask.java @@ -107,7 +107,8 @@ private void recreateIndex(ODocument indexDocument, ODatabaseDocumentEmbedded db OLogManager.instance() .info( this, - "Index '%s' is a durable automatic index and will be added as is without rebuilding", + "Index '%s' is a durable automatic index and will be added as is without" + + " rebuilding", indexMetadata.getName()); addIndexAsIs(indexDocument, index, db); } else { @@ -123,14 +124,16 @@ private void recreateIndex(ODocument indexDocument, ODatabaseDocumentEmbedded db OLogManager.instance() .info( this, - "Index '%s' is a durable non-automatic index and will be added as is without rebuilding", + "Index '%s' is a durable non-automatic index and will be added as is without" + + " rebuilding", indexMetadata.getName()); addIndexAsIs(indexDocument, index, db); } else { OLogManager.instance() .info( this, - "Index '%s' is a non-durable non-automatic index and will be added as is without rebuilding", + "Index '%s' is a non-durable non-automatic index and will be added as is without" + + " rebuilding", indexMetadata.getName()); addIndexAsIs(indexDocument, index, db); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/engine/UniqueIndexEngineValidator.java b/core/src/main/java/com/orientechnologies/orient/core/index/engine/UniqueIndexEngineValidator.java index b0c2dc3bb85..6aaae1d6d69 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/index/engine/UniqueIndexEngineValidator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/engine/UniqueIndexEngineValidator.java @@ -11,7 +11,9 @@ public class UniqueIndexEngineValidator implements IndexEngineValidator getAllBaseClasses(); - /** @return all the subclasses (one level hierarchy only) */ + /** + * @return all the subclasses (one level hierarchy only) + */ Collection getSubclasses(); - /** @return all the subclass hierarchy */ + /** + * @return all the subclass hierarchy + */ Collection getAllSubclasses(); - /** @return all recursively collected super classes */ + /** + * @return all recursively collected super classes + */ Collection getAllSuperClasses(); long getSize(); @@ -429,7 +435,9 @@ OIndex createIndex( */ OIndex getClassIndex(String iName); - /** @return All indexes for given class, not the inherited ones. */ + /** + * @return All indexes for given class, not the inherited ones. + */ Set getClassIndexes(); /** @@ -441,16 +449,22 @@ OIndex createIndex( /** Internal. All indexes for given class and its super classes. */ void getIndexes(Collection indexes); - /** @return All indexes for given class and its super classes. */ + /** + * @return All indexes for given class and its super classes. + */ Set getIndexes(); /** Returns the auto sharding index configured for the class if any. */ OIndex getAutoShardingIndex(); - /** @return true if this class represents a subclass of an edge class (E) */ + /** + * @return true if this class represents a subclass of an edge class (E) + */ boolean isEdgeType(); - /** @return true if this class represents a subclass of a vertex class (V) */ + /** + * @return true if this class represents a subclass of a vertex class (V) + */ boolean isVertexType(); String getCustom(String iName); diff --git a/core/src/main/java/com/orientechnologies/orient/core/metadata/schema/OImmutableClass.java b/core/src/main/java/com/orientechnologies/orient/core/metadata/schema/OImmutableClass.java index 4d12918c2c0..12488c448a5 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/metadata/schema/OImmutableClass.java +++ b/core/src/main/java/com/orientechnologies/orient/core/metadata/schema/OImmutableClass.java @@ -52,6 +52,7 @@ public class OImmutableClass implements OClass { /** use OClass.EDGE_CLASS_NAME instead */ @Deprecated public static final String EDGE_CLASS_NAME = OClass.EDGE_CLASS_NAME; + /** use OClass.EDGE_CLASS_NAME instead */ @Deprecated public static final String VERTEX_CLASS_NAME = OClass.VERTEX_CLASS_NAME; diff --git a/core/src/main/java/com/orientechnologies/orient/core/metadata/schema/OProperty.java b/core/src/main/java/com/orientechnologies/orient/core/metadata/schema/OProperty.java index 70cceda2f85..9c1069d0c03 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/metadata/schema/OProperty.java +++ b/core/src/main/java/com/orientechnologies/orient/core/metadata/schema/OProperty.java @@ -239,7 +239,9 @@ public static enum ATTRIBUTES { @Deprecated public OIndex getIndex(); - /** @return All indexes in which this property participates. */ + /** + * @return All indexes in which this property participates. + */ public Collection getAllIndexes(); /** diff --git a/core/src/main/java/com/orientechnologies/orient/core/metadata/schema/OPropertyImpl.java b/core/src/main/java/com/orientechnologies/orient/core/metadata/schema/OPropertyImpl.java index 07893d69080..71025f89d62 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/metadata/schema/OPropertyImpl.java +++ b/core/src/main/java/com/orientechnologies/orient/core/metadata/schema/OPropertyImpl.java @@ -248,7 +248,9 @@ public OIndex getIndex() { } } - /** @deprecated Use {@link OClass#getInvolvedIndexes(String...)} instead. */ + /** + * @deprecated Use {@link OClass#getInvolvedIndexes(String...)} instead. + */ @Deprecated public Set getIndexes() { acquireSchemaReadLock(); @@ -259,7 +261,9 @@ public Set getIndexes() { } } - /** @deprecated Use {@link OClass#areIndexed(String...)} instead. */ + /** + * @deprecated Use {@link OClass#areIndexed(String...)} instead. + */ @Deprecated public boolean isIndexed() { acquireSchemaReadLock(); diff --git a/core/src/main/java/com/orientechnologies/orient/core/metadata/schema/OSchemaShared.java b/core/src/main/java/com/orientechnologies/orient/core/metadata/schema/OSchemaShared.java index e9073ed30c9..68d0aa0b831 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/metadata/schema/OSchemaShared.java +++ b/core/src/main/java/com/orientechnologies/orient/core/metadata/schema/OSchemaShared.java @@ -528,7 +528,8 @@ public void fromStream(ODocument document) { OLogManager.instance() .error( this, - "Database's schema is empty! Recreating the system classes and allow the opening of the database but double check the integrity of the database", + "Database's schema is empty! Recreating the system classes and allow the opening of" + + " the database but double check the integrity of the database", null); return; } else if (schemaVersion != CURRENT_VERSION_NUMBER && VERSION_NUMBER_V5 != schemaVersion) { @@ -536,7 +537,8 @@ public void fromStream(ODocument document) { // changed associated with it // HANDLE SCHEMA UPGRADE throw new OConfigurationException( - "Database schema is different. Please export your old database with the previous version of OrientDB and reimport it using the current one."); + "Database schema is different. Please export your old database with the previous" + + " version of OrientDB and reimport it using the current one."); } properties.clear(); @@ -614,7 +616,8 @@ public void fromStream(ODocument document) { + superClassName + "' was declared in class '" + cls.getName() - + "' but was not found in schema. Remove the dependency or create the class to continue."); + + "' but was not found in schema. Remove the dependency or create the class" + + " to continue."); superClasses.add(superClass); } cls.setSuperClassesInternal(superClasses); @@ -882,7 +885,8 @@ private void saveInternal(ODatabaseDocumentInternal database) { if (database.getTransaction().isActive()) { throw new OSchemaException( - "Cannot change the schema while a transaction is active. Schema changes are not transactional"); + "Cannot change the schema while a transaction is active. Schema changes are not" + + " transactional"); } OScenarioThreadLocal.executeAsDistributed( diff --git a/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OImmutableUser.java b/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OImmutableUser.java index e3ba4f6e339..8358a8064ce 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OImmutableUser.java +++ b/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OImmutableUser.java @@ -96,7 +96,8 @@ public OSecurityRole checkIfAllowed( OLogManager.instance() .warn( this, - "User '%s' has a null role, ignoring it. Consider fixing this user's roles before continuing", + "User '%s' has a null role, ignoring it. Consider fixing this user's roles before" + + " continuing", getName()); else if (r.allow(resourceGeneric, resourceSpecific, iOperation)) return r; } @@ -111,7 +112,8 @@ public boolean isRuleDefined( OLogManager.instance() .warn( this, - "UseOSecurityAuthenticatorr '%s' has a null role, ignoring it. Consider fixing this user's roles before continuing", + "UseOSecurityAuthenticatorr '%s' has a null role, ignoring it. Consider fixing" + + " this user's roles before continuing", getName()); else if (r.hasRule(resourceGeneric, resourceSpecific)) return true; diff --git a/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OPredicateCache.java b/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OPredicateCache.java index 7b964519691..250d63b4895 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OPredicateCache.java +++ b/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OPredicateCache.java @@ -18,7 +18,9 @@ public class OPredicateCache { private Map map; private int mapSize; - /** @param size the size of the cache */ + /** + * @param size the size of the cache + */ public OPredicateCache(int size) { this.mapSize = size; map = diff --git a/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSecurityShared.java b/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSecurityShared.java index 30928959e0c..473e6236872 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSecurityShared.java +++ b/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSecurityShared.java @@ -76,6 +76,7 @@ public class OSecurityShared implements OSecurityInternal { /** role name -> class name -> true: has some rules, ie. it's not all allowed */ protected Map> roleHasPredicateSecurityForClass; + // used to avoid updating the above while the security schema is being created protected boolean skipRoleHasPredicateSecurityForClassUpdate = false; diff --git a/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OUser.java b/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OUser.java index 6794eaea655..2a372f988d7 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OUser.java +++ b/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OUser.java @@ -116,7 +116,8 @@ public void fromStream(final ODocument iSource) { OLogManager.instance() .warn( this, - "User '%s' is declared to have a role that does not exist in the database. Ignoring it.", + "User '%s' is declared to have a role that does not exist in the database. " + + " Ignoring it.", getName()); } } @@ -183,7 +184,8 @@ public ORole checkIfAllowed( OLogManager.instance() .warn( this, - "User '%s' has a null role, ignoring it. Consider fixing this user's roles before continuing", + "User '%s' has a null role, ignoring it. Consider fixing this user's roles before" + + " continuing", getName()); else if (r.allow(resourceGeneric, resourceSpecific, iOperation)) return r; } @@ -242,7 +244,8 @@ public boolean isRuleDefined( OLogManager.instance() .warn( this, - "User '%s' has a null role, bypass it. Consider to fix this user roles before to continue", + "User '%s' has a null role, bypass it. Consider to fix this user roles before to" + + " continue", getName()); else if (r.hasRule(resourceGeneric, resourceSpecific)) return true; diff --git a/core/src/main/java/com/orientechnologies/orient/core/metadata/sequence/OSequenceAction.java b/core/src/main/java/com/orientechnologies/orient/core/metadata/sequence/OSequenceAction.java index 789c2623199..fc49107f4e5 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/metadata/sequence/OSequenceAction.java +++ b/core/src/main/java/com/orientechnologies/orient/core/metadata/sequence/OSequenceAction.java @@ -15,7 +15,9 @@ */ package com.orientechnologies.orient.core.metadata.sequence; -/** @author marko */ +/** + * @author marko + */ public class OSequenceAction { public static final int CREATE = 1; diff --git a/core/src/main/java/com/orientechnologies/orient/core/metadata/sequence/OSequenceLibraryAbstract.java b/core/src/main/java/com/orientechnologies/orient/core/metadata/sequence/OSequenceLibraryAbstract.java index 057dbd33c5d..2b55916439e 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/metadata/sequence/OSequenceLibraryAbstract.java +++ b/core/src/main/java/com/orientechnologies/orient/core/metadata/sequence/OSequenceLibraryAbstract.java @@ -19,7 +19,9 @@ import com.orientechnologies.orient.core.db.record.OProxedResource; import com.orientechnologies.orient.core.exception.ODatabaseException; -/** @author mdjurovi */ +/** + * @author mdjurovi + */ public abstract class OSequenceLibraryAbstract extends OProxedResource implements OSequenceLibrary { diff --git a/core/src/main/java/com/orientechnologies/orient/core/metadata/sequence/OSequenceLimitReachedException.java b/core/src/main/java/com/orientechnologies/orient/core/metadata/sequence/OSequenceLimitReachedException.java index fc9d6701e1b..6b24b62603a 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/metadata/sequence/OSequenceLimitReachedException.java +++ b/core/src/main/java/com/orientechnologies/orient/core/metadata/sequence/OSequenceLimitReachedException.java @@ -17,7 +17,9 @@ import com.orientechnologies.common.exception.OException; -/** @author mdjurovi */ +/** + * @author mdjurovi + */ public class OSequenceLimitReachedException extends OException { public OSequenceLimitReachedException(String message) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/metadata/sequence/SequenceOrderType.java b/core/src/main/java/com/orientechnologies/orient/core/metadata/sequence/SequenceOrderType.java index dda7b44e953..d21a430abac 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/metadata/sequence/SequenceOrderType.java +++ b/core/src/main/java/com/orientechnologies/orient/core/metadata/sequence/SequenceOrderType.java @@ -15,7 +15,9 @@ */ package com.orientechnologies.orient.core.metadata.sequence; -/** @author mdjurovi */ +/** + * @author mdjurovi + */ public enum SequenceOrderType { ORDER_POSITIVE((byte) 1), ORDER_NEGATIVE((byte) 2); diff --git a/core/src/main/java/com/orientechnologies/orient/core/query/live/OLiveQueryHook.java b/core/src/main/java/com/orientechnologies/orient/core/query/live/OLiveQueryHook.java index ece73dc862f..5e2b70b66b0 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/query/live/OLiveQueryHook.java +++ b/core/src/main/java/com/orientechnologies/orient/core/query/live/OLiveQueryHook.java @@ -70,7 +70,8 @@ public static Integer subscribe( OLogManager.instance() .warn( db, - "Live query support is disabled impossible to subscribe a listener, set '%s' to true for enable the live query support", + "Live query support is disabled impossible to subscribe a listener, set '%s' to true" + + " for enable the live query support", QUERY_LIVE_SUPPORT.getKey()); return -1; } @@ -90,7 +91,8 @@ public static void unsubscribe(Integer id, ODatabaseInternal db) { OLogManager.instance() .warn( db, - "Live query support is disabled impossible to unsubscribe a listener, set '%s' to true for enable the live query support", + "Live query support is disabled impossible to unsubscribe a listener, set '%s' to" + + " true for enable the live query support", QUERY_LIVE_SUPPORT.getKey()); return; } diff --git a/core/src/main/java/com/orientechnologies/orient/core/query/live/OLiveQueryHookV2.java b/core/src/main/java/com/orientechnologies/orient/core/query/live/OLiveQueryHookV2.java index 4c375887e91..054ac91d10a 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/query/live/OLiveQueryHookV2.java +++ b/core/src/main/java/com/orientechnologies/orient/core/query/live/OLiveQueryHookV2.java @@ -125,7 +125,8 @@ public static Integer subscribe( OLogManager.instance() .warn( db, - "Live query support is disabled impossible to subscribe a listener, set '%s' to true for enable the live query support", + "Live query support is disabled impossible to subscribe a listener, set '%s' to true" + + " for enable the live query support", QUERY_LIVE_SUPPORT.getKey()); return -1; } @@ -145,7 +146,8 @@ public static void unsubscribe(Integer id, ODatabaseInternal db) { OLogManager.instance() .warn( db, - "Live query support is disabled impossible to unsubscribe a listener, set '%s' to true for enable the live query support", + "Live query support is disabled impossible to unsubscribe a listener, set '%s' to" + + " true for enable the live query support", QUERY_LIVE_SUPPORT.getKey()); return; } diff --git a/core/src/main/java/com/orientechnologies/orient/core/query/live/OLiveQueryQueueThread.java b/core/src/main/java/com/orientechnologies/orient/core/query/live/OLiveQueryQueueThread.java index 6a2ca10bf2b..3c45c7e9f5a 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/query/live/OLiveQueryQueueThread.java +++ b/core/src/main/java/com/orientechnologies/orient/core/query/live/OLiveQueryQueueThread.java @@ -26,7 +26,9 @@ import java.util.concurrent.ConcurrentMap; import java.util.concurrent.LinkedBlockingQueue; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OLiveQueryQueueThread extends Thread { private final BlockingQueue queue; diff --git a/core/src/main/java/com/orientechnologies/orient/core/query/live/OLiveQueryQueueThreadV2.java b/core/src/main/java/com/orientechnologies/orient/core/query/live/OLiveQueryQueueThreadV2.java index d1c9a971511..751a0fca6db 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/query/live/OLiveQueryQueueThreadV2.java +++ b/core/src/main/java/com/orientechnologies/orient/core/query/live/OLiveQueryQueueThreadV2.java @@ -25,7 +25,9 @@ import java.util.List; import java.util.concurrent.BlockingQueue; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OLiveQueryQueueThreadV2 extends Thread { private static final OLogManager logger = OLogManager.instance(); diff --git a/core/src/main/java/com/orientechnologies/orient/core/record/ODirection.java b/core/src/main/java/com/orientechnologies/orient/core/record/ODirection.java index 365e13edfef..683fb44dfb7 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/record/ODirection.java +++ b/core/src/main/java/com/orientechnologies/orient/core/record/ODirection.java @@ -19,7 +19,9 @@ */ package com.orientechnologies.orient.core.record; -/** @author Luigi Dell'Aquila */ +/** + * @author Luigi Dell'Aquila + */ public enum ODirection { OUT, IN, diff --git a/core/src/main/java/com/orientechnologies/orient/core/record/OEdge.java b/core/src/main/java/com/orientechnologies/orient/core/record/OEdge.java index ec7505ea49c..b70bead71e9 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/record/OEdge.java +++ b/core/src/main/java/com/orientechnologies/orient/core/record/OEdge.java @@ -24,7 +24,9 @@ import java.util.Optional; import java.util.Set; -/** @author Luigi Dell'Aquila */ +/** + * @author Luigi Dell'Aquila + */ public interface OEdge extends OElement { public static final String DIRECTION_OUT = "out"; public static final String DIRECTION_IN = "in"; diff --git a/core/src/main/java/com/orientechnologies/orient/core/record/OElement.java b/core/src/main/java/com/orientechnologies/orient/core/record/OElement.java index 69e3f4f0ddb..4f2557e2a11 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/record/OElement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/record/OElement.java @@ -24,7 +24,9 @@ import java.util.Optional; import java.util.Set; -/** @author Luigi Dell'Aquila */ +/** + * @author Luigi Dell'Aquila + */ public interface OElement extends ORecord { /** diff --git a/core/src/main/java/com/orientechnologies/orient/core/record/OVertex.java b/core/src/main/java/com/orientechnologies/orient/core/record/OVertex.java index 1bb31675aa8..68669089ef0 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/record/OVertex.java +++ b/core/src/main/java/com/orientechnologies/orient/core/record/OVertex.java @@ -22,7 +22,9 @@ import com.orientechnologies.orient.core.id.ORID; import com.orientechnologies.orient.core.metadata.schema.OClass; -/** @author Luigi Dell'Aquila */ +/** + * @author Luigi Dell'Aquila + */ public interface OVertex extends OElement { Iterable getEdges(ODirection direction); diff --git a/core/src/main/java/com/orientechnologies/orient/core/record/impl/ODirtyManager.java b/core/src/main/java/com/orientechnologies/orient/core/record/impl/ODirtyManager.java index 7da1bd17275..34b44ab15ee 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/record/impl/ODirtyManager.java +++ b/core/src/main/java/com/orientechnologies/orient/core/record/impl/ODirtyManager.java @@ -26,7 +26,9 @@ import java.util.IdentityHashMap; import java.util.Set; -/** @author Emanuele Tagliafetti */ +/** + * @author Emanuele Tagliafetti + */ public class ODirtyManager { private ODirtyManager overrider; diff --git a/core/src/main/java/com/orientechnologies/orient/core/record/impl/ODocument.java b/core/src/main/java/com/orientechnologies/orient/core/record/impl/ODocument.java index c5effe8a81e..5dc1a816dbe 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/record/impl/ODocument.java +++ b/core/src/main/java/com/orientechnologies/orient/core/record/impl/ODocument.java @@ -593,7 +593,8 @@ public void setProperty(String iPropetyName, Object iPropertyValue, OType... iFi if (!DB_CUSTOM_SUPPORT.getValueAsBoolean()) { throw new ODatabaseException( String.format( - "OType CUSTOM used by serializable types, for value '%s' is not enabled, set `db.custom.support` to true for enable it", + "OType CUSTOM used by serializable types, for value '%s' is not enabled, set" + + " `db.custom.support` to true for enable it", iPropertyValue)); } } @@ -758,7 +759,8 @@ protected static void validateField(ODocument iRecord, OImmutableProperty p) throw new OValidationException( "The field '" + p.getFullName() - + "' has been declared as EMBEDDEDLIST but an incompatible type is used. Value: " + + "' has been declared as EMBEDDEDLIST but an incompatible type is used. Value:" + + " " + fieldValue); if (p.getLinkedClass() != null) { for (Object item : ((List) fieldValue)) validateEmbedded(p, item); @@ -1620,7 +1622,8 @@ public ODocument field(String iFieldName, Object iPropertyValue, OType... iField throw new IllegalArgumentException( "Property '" + iFieldName - + "' points to linked collection of items. You can only change embedded documents in this way"); + + "' points to linked collection of items. You can only change embedded" + + " documents in this way"); ((ODocument) subObjectItem).field(subFieldName, iPropertyValue); } else if (subObjectItem instanceof Map) { // KEY/VALUE @@ -1634,7 +1637,8 @@ public ODocument field(String iFieldName, Object iPropertyValue, OType... iField throw new IllegalArgumentException( "Property '" + iFieldName.substring(0, lastSep) - + "' is null, is possible to set a value with dotted notation only on not null property"); + + "' is null, is possible to set a value with dotted notation only on not null" + + " property"); return null; } @@ -1740,7 +1744,8 @@ public ODocument field(String iFieldName, Object iPropertyValue, OType... iField if (!DB_CUSTOM_SUPPORT.getValueAsBoolean()) { throw new ODatabaseException( String.format( - "OType CUSTOM used by serializable types, for value '%s' is not enabled, set `db.custom.support` to true for enable it", + "OType CUSTOM used by serializable types, for value '%s' is not enabled, set" + + " `db.custom.support` to true for enable it", iPropertyValue)); } } @@ -2391,7 +2396,8 @@ public ODocument setFieldType(final String iFieldName, final OType iFieldType) { if (!DB_CUSTOM_SUPPORT.getValueAsBoolean()) { throw new ODatabaseException( String.format( - "OType CUSTOM used by serializable types is not enabled, set `db.custom.support` to true for enable it")); + "OType CUSTOM used by serializable types is not enabled, set `db.custom.support`" + + " to true for enable it")); } } // SET THE FORCED TYPE @@ -2878,7 +2884,8 @@ protected OGlobalProperty getGlobalPropertyById(int id) { ODatabaseDocument db = getDatabase(); if (db == null || db.isClosed()) throw new ODatabaseException( - "Cannot unmarshall the document because no database is active, use detach for use the document outside the database session scope"); + "Cannot unmarshall the document because no database is active, use detach for use the" + + " document outside the database session scope"); OMetadataInternal metadata = (OMetadataInternal) db.getMetadata(); if (metadata.getImmutableSchemaSnapshot() != null) metadata.clearThreadLocalSchemaSnapshot(); metadata.reload(); diff --git a/core/src/main/java/com/orientechnologies/orient/core/record/impl/OEdgeDelegate.java b/core/src/main/java/com/orientechnologies/orient/core/record/impl/OEdgeDelegate.java index 00d59b944a5..9069a1bee1d 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/record/impl/OEdgeDelegate.java +++ b/core/src/main/java/com/orientechnologies/orient/core/record/impl/OEdgeDelegate.java @@ -42,7 +42,9 @@ import java.util.Optional; import java.util.Set; -/** @author Luigi Dell'Aquila */ +/** + * @author Luigi Dell'Aquila + */ public class OEdgeDelegate implements OEdge { protected OVertex vOut; protected OVertex vIn; diff --git a/core/src/main/java/com/orientechnologies/orient/core/record/impl/OEdgeIterator.java b/core/src/main/java/com/orientechnologies/orient/core/record/impl/OEdgeIterator.java index dc20e5d30e8..d31a13e679e 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/record/impl/OEdgeIterator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/record/impl/OEdgeIterator.java @@ -33,7 +33,9 @@ import com.orientechnologies.orient.core.record.OVertex; import java.util.Iterator; -/** @author Luigi Dell'Aquila */ +/** + * @author Luigi Dell'Aquila + */ public class OEdgeIterator extends OLazyWrapperIterator { private final OVertex sourceVertex; @@ -89,7 +91,8 @@ public OEdge createGraphElement(final Object iObject) { OLogManager.instance() .warn( this, - "Found a record (%s) that is not an edge. Source vertex : %s, Target vertex : %s, Database : %s", + "Found a record (%s) that is not an edge. Source vertex : %s, Target vertex : %s," + + " Database : %s", rec, sourceVertex != null ? sourceVertex.getIdentity() : null, targetVertex != null ? targetVertex.getIdentity() : null, diff --git a/core/src/main/java/com/orientechnologies/orient/core/record/impl/OVertexDelegate.java b/core/src/main/java/com/orientechnologies/orient/core/record/impl/OVertexDelegate.java index ee066093405..3bf7f7e9d17 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/record/impl/OVertexDelegate.java +++ b/core/src/main/java/com/orientechnologies/orient/core/record/impl/OVertexDelegate.java @@ -51,7 +51,9 @@ import java.util.Optional; import java.util.Set; -/** @author Luigi Dell'Aquila */ +/** + * @author Luigi Dell'Aquila + */ public class OVertexDelegate implements OVertex { private static final String CONNECTION_OUT_PREFIX = "out_"; private static final String CONNECTION_IN_PREFIX = "in_"; diff --git a/core/src/main/java/com/orientechnologies/orient/core/schedule/OCronExpression.java b/core/src/main/java/com/orientechnologies/orient/core/schedule/OCronExpression.java index ed1b19a6a3b..feb760ead22 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/schedule/OCronExpression.java +++ b/core/src/main/java/com/orientechnologies/orient/core/schedule/OCronExpression.java @@ -496,7 +496,8 @@ protected synchronized void buildExpression(String expression) throws ParseExcep if (!dayOfMSpec || dayOfWSpec) { if (!dayOfWSpec || dayOfMSpec) { throw new ParseException( - "Support for specifying both a day-of-week AND a day-of-month parameter is not implemented", + "Support for specifying both a day-of-week AND a day-of-month parameter is not" + + " implemented", 0); } } @@ -728,7 +729,8 @@ protected int checkNext(int pos, String s, int val, int type) throws ParseExcept } if (val > 31) throw new ParseException( - "The 'W' option does not make sense with values larger than 31 (max number of days in a month)", + "The 'W' option does not make sense with values larger than 31 (max number of days in a" + + " month)", i); TreeSet set = getSet(type); set.add(val); @@ -923,14 +925,16 @@ protected String getExpressionSetSummary(java.util.ArrayList list) { } protected int skipWhiteSpace(int i, String s) { - for (; i < s.length() && (s.charAt(i) == ' ' || s.charAt(i) == '\t'); i++) {; + for (; i < s.length() && (s.charAt(i) == ' ' || s.charAt(i) == '\t'); i++) { + ; } return i; } protected int findNextWhiteSpace(int i, String s) { - for (; i < s.length() && (s.charAt(i) != ' ' || s.charAt(i) != '\t'); i++) {; + for (; i < s.length() && (s.charAt(i) != ' ' || s.charAt(i) != '\t'); i++) { + ; } return i; @@ -1475,7 +1479,8 @@ public synchronized Date getTimeAfter(Date afterTime) { } } else { // dayOfWSpec && !dayOfMSpec throw new UnsupportedOperationException( - "Support for specifying both a day-of-week AND a day-of-month parameter is not implemented."); + "Support for specifying both a day-of-week AND a day-of-month parameter is not" + + " implemented."); } cl.set(Calendar.DAY_OF_MONTH, day); diff --git a/core/src/main/java/com/orientechnologies/orient/core/security/ODefaultSecuritySystem.java b/core/src/main/java/com/orientechnologies/orient/core/security/ODefaultSecuritySystem.java index bfc01a8453a..133c2cb31db 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/security/ODefaultSecuritySystem.java +++ b/core/src/main/java/com/orientechnologies/orient/core/security/ODefaultSecuritySystem.java @@ -639,7 +639,8 @@ public void reload(OSecurityUser user, ODocument configDoc) { OLogManager.instance() .warn( this, - "ODefaultServerSecurity.reload(ODocument) The provided configuration document is null"); + "ODefaultServerSecurity.reload(ODocument) The provided configuration document is" + + " null"); throw new OSecuritySystemException( "ODefaultServerSecurity.reload(ODocument) The provided configuration document is null"); } @@ -711,14 +712,16 @@ private void loadAuthenticators(final ODocument authDoc) { OLogManager.instance() .error( this, - "ODefaultServerSecurity.loadAuthenticators() class is not an OSecurityAuthenticator", + "ODefaultServerSecurity.loadAuthenticators() class is not an" + + " OSecurityAuthenticator", null); } } else { OLogManager.instance() .error( this, - "ODefaultServerSecurity.loadAuthenticators() authentication class is null for %s", + "ODefaultServerSecurity.loadAuthenticators() authentication class is null" + + " for %s", null, name); } @@ -727,7 +730,8 @@ private void loadAuthenticators(final ODocument authDoc) { OLogManager.instance() .error( this, - "ODefaultServerSecurity.loadAuthenticators() authentication object is missing name", + "ODefaultServerSecurity.loadAuthenticators() authentication object is missing" + + " name", null); } } catch (Exception ex) { @@ -964,14 +968,16 @@ private void reloadPasswordValidator() { OLogManager.instance() .error( this, - "ODefaultServerSecurity.reloadPasswordValidator() class is not an OPasswordValidator", + "ODefaultServerSecurity.reloadPasswordValidator() class is not an" + + " OPasswordValidator", null); } } else { OLogManager.instance() .error( this, - "ODefaultServerSecurity.reloadPasswordValidator() PasswordValidator class property is missing", + "ODefaultServerSecurity.reloadPasswordValidator() PasswordValidator class" + + " property is missing", null); } } @@ -1001,14 +1007,16 @@ private void reloadImportLDAP() { OLogManager.instance() .error( this, - "ODefaultServerSecurity.reloadImportLDAP() class is not an OSecurityComponent", + "ODefaultServerSecurity.reloadImportLDAP() class is not an" + + " OSecurityComponent", null); } } else { OLogManager.instance() .error( this, - "ODefaultServerSecurity.reloadImportLDAP() ImportLDAP class property is missing", + "ODefaultServerSecurity.reloadImportLDAP() ImportLDAP class property is" + + " missing", null); } } @@ -1038,14 +1046,16 @@ private void reloadAuditingService() { OLogManager.instance() .error( this, - "ODefaultServerSecurity.reloadAuditingService() class is not an OAuditingService", + "ODefaultServerSecurity.reloadAuditingService() class is not an" + + " OAuditingService", null); } } else { OLogManager.instance() .error( this, - "ODefaultServerSecurity.reloadAuditingService() Auditing class property is missing", + "ODefaultServerSecurity.reloadAuditingService() Auditing class property is" + + " missing", null); } } diff --git a/core/src/main/java/com/orientechnologies/orient/core/security/kerberos/OKrb5ClientLoginModuleConfig.java b/core/src/main/java/com/orientechnologies/orient/core/security/kerberos/OKrb5ClientLoginModuleConfig.java index 48284083d34..ecc6d180d5a 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/security/kerberos/OKrb5ClientLoginModuleConfig.java +++ b/core/src/main/java/com/orientechnologies/orient/core/security/kerberos/OKrb5ClientLoginModuleConfig.java @@ -37,6 +37,7 @@ public class OKrb5ClientLoginModuleConfig extends Configuration { public AppConfigurationEntry[] getAppConfigurationEntry(String applicationName) { return appConfigEntries; } + /* public OKrb5ClientLoginModuleConfig(String ccPath) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/OCompactedLinkSerializer.java b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/OCompactedLinkSerializer.java index be9ba6cd6e4..55065352f80 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/OCompactedLinkSerializer.java +++ b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/OCompactedLinkSerializer.java @@ -13,6 +13,7 @@ import java.nio.ByteBuffer; public class OCompactedLinkSerializer implements OBinarySerializer { + public static final byte ID = 22; public static final OCompactedLinkSerializer INSTANCE = new OCompactedLinkSerializer(); @@ -68,7 +69,7 @@ public OIdentifiable deserialize(byte[] stream, int startPosition) { long position = 0; for (int i = 0; i < numberSize; i++) { - position = position | ((0xFF & stream[startPosition + i]) << (i * 8)); + position = position | ((long) (0xFF & stream[startPosition + i]) << (i * 8)); } return new ORecordId(cluster, position); @@ -121,7 +122,7 @@ public OIdentifiable deserializeNativeObject(byte[] stream, int startPosition) { long position = 0; for (int i = 0; i < numberSize; i++) { - position = position | ((0xFF & stream[startPosition + i]) << (i * 8)); + position = position | ((long) (0xFF & stream[startPosition + i]) << (i * 8)); } return new ORecordId(cluster, position); @@ -171,7 +172,26 @@ public OIdentifiable deserializeFromByteBufferObject(ByteBuffer buffer) { long position = 0; for (int i = 0; i < numberSize; i++) { - position = position | ((0xFF & number[i]) << (i * 8)); + position = position | ((long) (0xFF & number[i]) << (i * 8)); + } + + return new ORecordId(cluster, position); + } + + @Override + public OIdentifiable deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + final int cluster = buffer.getShort(offset); + offset += Short.BYTES; + + final int numberSize = buffer.get(offset); + offset += Byte.BYTES; + + final byte[] number = new byte[numberSize]; + buffer.get(offset, number); + + long position = 0; + for (int i = 0; i < numberSize; i++) { + position = position | ((long) (0xFF & number[i]) << (i * 8)); } return new ORecordId(cluster, position); @@ -184,6 +204,13 @@ public int getObjectSizeInByteBuffer(ByteBuffer buffer) { + OShortSerializer.SHORT_SIZE; } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return buffer.get(offset + OShortSerializer.SHORT_SIZE) + + OByteSerializer.BYTE_SIZE + + OShortSerializer.SHORT_SIZE; + } + @Override public OIdentifiable deserializeFromByteBufferObject( ByteBuffer buffer, OWALChanges walChanges, int offset) { @@ -197,7 +224,7 @@ public OIdentifiable deserializeFromByteBufferObject( long position = 0; for (int i = 0; i < numberSize; i++) { - position = position | ((0xFF & number[i]) << (i * 8)); + position = position | ((long) (0xFF & number[i]) << (i * 8)); } return new ORecordId(cluster, position); diff --git a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/OLinkSerializer.java b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/OLinkSerializer.java index f008fccaabd..f607cee68ca 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/OLinkSerializer.java +++ b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/OLinkSerializer.java @@ -133,12 +133,30 @@ public OIdentifiable deserializeFromByteBufferObject(ByteBuffer buffer) { return new ORecordId(clusterId, clusterPosition); } + @Override + public OIdentifiable deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + final int clusterId = buffer.getShort(offset); + offset += Short.BYTES; + + final byte[] stream = new byte[OLongSerializer.LONG_SIZE]; + buffer.get(offset, stream); + // Wrong implementation but needed for binary compatibility + final long clusterPosition = OLongSerializer.INSTANCE.deserialize(stream, 0); + + return new ORecordId(clusterId, clusterPosition); + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return RID_SIZE; } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return RID_SIZE; + } + /** {@inheritDoc} */ @Override public OIdentifiable deserializeFromByteBufferObject( @@ -152,9 +170,6 @@ public OIdentifiable deserializeFromByteBufferObject( buffer, offset + OShortSerializer.SHORT_SIZE, OLongSerializer.LONG_SIZE), 0); - // final long clusterPosition = OLongSerializer.INSTANCE - // .deserializeFromDirectMemory(pointer, offset + OShortSerializer.SHORT_SIZE); - return new ORecordId(clusterId, clusterPosition); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/index/CompositeKeySerializer.java b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/index/CompositeKeySerializer.java index f6cadf2f87b..505df02abf8 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/index/CompositeKeySerializer.java +++ b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/index/CompositeKeySerializer.java @@ -23,6 +23,7 @@ import java.util.List; public final class CompositeKeySerializer implements OBinarySerializer { + public int getObjectSize(OCompositeKey compositeKey, Object... hints) { final OType[] types = (OType[]) hints; final List keys = compositeKey.getKeys(); @@ -42,32 +43,20 @@ public int getObjectSize(OCompositeKey compositeKey, Object... hints) { } private static int sizeOfKey(final OType type, final Object key) { - switch (type) { - case BOOLEAN: - case BYTE: - return 1; - case DATE: - case DATETIME: - case DOUBLE: - case LONG: - return OLongSerializer.LONG_SIZE; - case BINARY: - return ((byte[]) key).length + OIntegerSerializer.INT_SIZE; - case DECIMAL: + return switch (type) { + case BOOLEAN, BYTE -> 1; + case DATE, DATETIME, DOUBLE, LONG -> OLongSerializer.LONG_SIZE; + case BINARY -> ((byte[]) key).length + OIntegerSerializer.INT_SIZE; + case DECIMAL -> { final BigDecimal bigDecimal = ((BigDecimal) key); - return 2 * OIntegerSerializer.INT_SIZE + bigDecimal.unscaledValue().toByteArray().length; - case FLOAT: - case INTEGER: - return OIntegerSerializer.INT_SIZE; - case LINK: - return OCompactedLinkSerializer.INSTANCE.getObjectSize((ORID) key); - case SHORT: - return OShortSerializer.SHORT_SIZE; - case STRING: - return OUTF8Serializer.INSTANCE.getObjectSize((String) key); - default: - throw new OIndexException("Unsupported key type " + type); - } + yield 2 * OIntegerSerializer.INT_SIZE + bigDecimal.unscaledValue().toByteArray().length; + } + case FLOAT, INTEGER -> OIntegerSerializer.INT_SIZE; + case LINK -> OCompactedLinkSerializer.INSTANCE.getObjectSize((ORID) key); + case SHORT -> OShortSerializer.SHORT_SIZE; + case STRING -> OUTF8Serializer.INSTANCE.getObjectSize((String) key); + default -> throw new OIndexException("Unsupported key type " + type); + }; } public void serialize( @@ -177,6 +166,30 @@ private static OCompositeKey deserialize(ByteBuffer buffer) { return keys; } + private static OCompositeKey deserialize(int offset, ByteBuffer buffer) { + offset += Integer.BYTES; + final int keyLen = buffer.getInt(offset); + offset += OIntegerSerializer.INT_SIZE; + + OCompositeKey keys = new OCompositeKey(keyLen); + for (int i = 0; i < keyLen; i++) { + final byte typeId = buffer.get(offset); + offset++; + + if (typeId < 0) { + keys.addKey(null); + } else { + final OType type = OType.getById(typeId); + assert type != null; + var delta = getKeySizeInByteBuffer(offset, buffer, type); + keys.addKey(deserializeKeyFromByteBuffer(offset, buffer, type)); + offset += delta; + } + } + + return keys; + } + private static Object deserializeKeyFromByteBuffer(final ByteBuffer buffer, final OType type) { switch (type) { case BINARY: @@ -216,6 +229,80 @@ private static Object deserializeKeyFromByteBuffer(final ByteBuffer buffer, fina } } + private static Object deserializeKeyFromByteBuffer( + int offset, final ByteBuffer buffer, final OType type) { + switch (type) { + case BINARY: + final int len = buffer.getInt(offset); + offset += Integer.BYTES; + + final byte[] array = new byte[len]; + buffer.get(offset, array); + return array; + case BOOLEAN: + return buffer.get(offset) > 0; + case BYTE: + return buffer.get(offset); + case DATE: + case DATETIME: + return new Date(buffer.getLong(offset)); + case DECIMAL: + final int scale = buffer.getInt(offset); + offset += Integer.BYTES; + + final int unscaledValueLen = buffer.getInt(offset); + offset += Integer.BYTES; + + final byte[] unscaledValue = new byte[unscaledValueLen]; + buffer.get(offset, unscaledValue); + + return new BigDecimal(new BigInteger(unscaledValue), scale); + case DOUBLE: + return Double.longBitsToDouble(buffer.getLong(offset)); + case FLOAT: + return Float.intBitsToFloat(buffer.getInt(offset)); + case INTEGER: + return buffer.getInt(offset); + case LINK: + return OCompactedLinkSerializer.INSTANCE.deserializeFromByteBufferObject(offset, buffer); + case LONG: + return buffer.getLong(offset); + case SHORT: + return buffer.getShort(offset); + case STRING: + return OUTF8Serializer.INSTANCE.deserializeFromByteBufferObject(offset, buffer); + default: + throw new OIndexException("Unsupported index type " + type); + } + } + + private static int getKeySizeInByteBuffer(int offset, final ByteBuffer buffer, final OType type) { + switch (type) { + case BINARY: + final int len = buffer.getInt(offset); + return Integer.BYTES + len; + case BOOLEAN, BYTE: + return Byte.BYTES; + case DATE: + case DATETIME, DOUBLE, LONG: + return Long.BYTES; + case DECIMAL: + offset += Integer.BYTES; + final int unscaledValueLen = buffer.getInt(offset); + return 2 * Integer.BYTES + unscaledValueLen; + case FLOAT, INTEGER: + return Integer.BYTES; + case LINK: + return OCompactedLinkSerializer.INSTANCE.getObjectSizeInByteBuffer(offset, buffer); + case SHORT: + return Short.BYTES; + case STRING: + return OUTF8Serializer.INSTANCE.getObjectSizeInByteBuffer(offset, buffer); + default: + throw new OIndexException("Unsupported index type " + type); + } + } + private static Object deserializeKeyFromByteBuffer( final int offset, final ByteBuffer buffer, final OType type, final OWALChanges walChanges) { switch (type) { @@ -360,12 +447,22 @@ public OCompositeKey deserializeFromByteBufferObject(ByteBuffer buffer) { return deserialize(buffer); } + @Override + public OCompositeKey deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + return deserialize(offset, buffer); + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return buffer.getInt(); } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return buffer.getInt(offset); + } + /** {@inheritDoc} */ @Override public OCompositeKey deserializeFromByteBufferObject( diff --git a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/index/OCompositeKeySerializer.java b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/index/OCompositeKeySerializer.java index 5529b4a1407..3822a7ea592 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/index/OCompositeKeySerializer.java +++ b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/index/OCompositeKeySerializer.java @@ -254,14 +254,14 @@ public OCompositeKey preprocess(OCompositeKey value, Object... hints) { OBinarySerializer keySerializer = factory.getObjectSerializer(type); if (key instanceof Map && !(type == OType.EMBEDDEDMAP || type == OType.LINKMAP) - && ((Map) key).size() == 1 - && ((Map) key) + && ((Map) key).size() == 1 + && ((Map) key) .keySet() .iterator() .next() .getClass() .isAssignableFrom(type.getDefaultJavaType())) { - key = ((Map) key).keySet().iterator().next(); + key = ((Map) key).keySet().iterator().next(); } compositeKey.addKey(keySerializer.preprocess(key)); } else { @@ -333,12 +333,44 @@ public OCompositeKey deserializeFromByteBufferObject(ByteBuffer buffer) { return compositeKey; } + /** {@inheritDoc} */ + @Override + public OCompositeKey deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + final OCompositeKey compositeKey = new OCompositeKey(); + + offset += OIntegerSerializer.INT_SIZE; + final int keysSize = buffer.getInt(offset); + offset += OIntegerSerializer.INT_SIZE; + + final OBinarySerializerFactory factory = OBinarySerializerFactory.getInstance(); + for (int i = 0; i < keysSize; i++) { + final byte serializerId = buffer.get(offset); + offset++; + @SuppressWarnings("unchecked") + OBinarySerializer binarySerializer = + (OBinarySerializer) factory.getObjectSerializer(serializerId); + + var delta = binarySerializer.getObjectSizeInByteBuffer(offset, buffer); + final Object key = binarySerializer.deserializeFromByteBufferObject(offset, buffer); + offset += delta; + + compositeKey.addKey(key); + } + + return compositeKey; + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return buffer.getInt(); } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return buffer.getInt(offset); + } + /** {@inheritDoc} */ @Override public OCompositeKey deserializeFromByteBufferObject( diff --git a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/index/OSimpleKeySerializer.java b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/index/OSimpleKeySerializer.java index bf216ec3891..0d6867226cb 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/index/OSimpleKeySerializer.java +++ b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/index/OSimpleKeySerializer.java @@ -37,7 +37,6 @@ @SuppressWarnings({"rawtypes", "unchecked"}) public class OSimpleKeySerializer> implements OBinarySerializer { - private OType type; private OBinarySerializer binarySerializer; public static final byte ID = 15; @@ -45,12 +44,6 @@ public class OSimpleKeySerializer> implements OBinarySer public OSimpleKeySerializer() {} - public OSimpleKeySerializer(final OType iType) { - type = iType; - - binarySerializer = OBinarySerializerFactory.getInstance().getObjectSerializer(iType); - } - public int getObjectSize(T key, Object... hints) { init(key, hints); return OBinarySerializerFactory.TYPE_IDENTIFIER_SIZE + binarySerializer.getObjectSize(key); @@ -87,19 +80,27 @@ protected void init(T key, Object[] hints) { if (binarySerializer == null) { final OType[] types; - if (hints != null && hints.length > 0) types = (OType[]) hints; - else types = OCommonConst.EMPTY_TYPES_ARRAY; + if (hints != null && hints.length > 0) { + types = (OType[]) hints; + } else { + types = OCommonConst.EMPTY_TYPES_ARRAY; + } - if (types.length > 0) type = types[0]; - else type = OType.getTypeByClass(key.getClass()); + OType type; + if (types.length > 0) { + type = types[0]; + } else { + type = OType.getTypeByClass(key.getClass()); + } binarySerializer = OBinarySerializerFactory.getInstance().getObjectSerializer(type); } } protected void init(byte serializerId) { - if (binarySerializer == null) + if (binarySerializer == null) { binarySerializer = OBinarySerializerFactory.getInstance().getObjectSerializer(serializerId); + } } public int getObjectSizeNative(byte[] stream, int startPosition) { @@ -157,6 +158,15 @@ public T deserializeFromByteBufferObject(ByteBuffer buffer) { return (T) binarySerializer.deserializeFromByteBufferObject(buffer); } + @Override + public T deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + final byte typeId = buffer.get(offset); + offset++; + + init(typeId); + return (T) binarySerializer.deserializeFromByteBufferObject(offset, buffer); + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { @@ -166,6 +176,16 @@ public int getObjectSizeInByteBuffer(ByteBuffer buffer) { + binarySerializer.getObjectSizeInByteBuffer(buffer); } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + final byte serializerId = buffer.get(offset); + offset++; + + init(serializerId); + return OBinarySerializerFactory.TYPE_IDENTIFIER_SIZE + + binarySerializer.getObjectSizeInByteBuffer(offset, buffer); + } + /** {@inheritDoc} */ @Override public T deserializeFromByteBufferObject(ByteBuffer buffer, OWALChanges walChanges, int offset) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/HelperClasses.java b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/HelperClasses.java index 58ffd939023..96c5cd1bee7 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/HelperClasses.java +++ b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/HelperClasses.java @@ -61,7 +61,9 @@ import java.util.TimeZone; import java.util.UUID; -/** @author mdjurovi */ +/** + * @author mdjurovi + */ public class HelperClasses { public static final String CHARSET_UTF_8 = "UTF-8"; protected static final ORecordId NULL_RECORD_ID = new ORecordId(-2, ORID.CLUSTER_POS_INVALID); diff --git a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/OResultBinary.java b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/OResultBinary.java index f30fe041613..5c93d94e5d3 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/OResultBinary.java +++ b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/OResultBinary.java @@ -32,7 +32,9 @@ import java.util.Optional; import java.util.Set; -/** @author mdjurovi */ +/** + * @author mdjurovi + */ public class OResultBinary implements OResult { private ODocumentSerializer serializer; diff --git a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/string/ORecordSerializerCSVAbstract.java b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/string/ORecordSerializerCSVAbstract.java index 90c4148e45f..7b17e3b9b7d 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/string/ORecordSerializerCSVAbstract.java +++ b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/string/ORecordSerializerCSVAbstract.java @@ -335,7 +335,8 @@ public void fieldToStream( { if (!(iValue instanceof OIdentifiable)) throw new OSerializationException( - "Found an unexpected type during marshalling of a LINK where a OIdentifiable (ORID or any Record) was expected. The string representation of the object is: " + "Found an unexpected type during marshalling of a LINK where a OIdentifiable (ORID" + + " or any Record) was expected. The string representation of the object is: " + iValue); if (!((OIdentifiable) iValue).getIdentity().isValid() @@ -690,7 +691,8 @@ else if (item.length() > 2 && item.charAt(0) == OStringSerializerHelper.EMBEDDED if (linkedType == null) throw new IllegalArgumentException( - "Linked type cannot be null. Probably the serialized type has not stored the type along with data"); + "Linked type cannot be null. Probably the serialized type has not stored the type" + + " along with data"); } if (iLinkedType == OType.CUSTOM) item = item.substring(1, item.length() - 1); diff --git a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/stream/OMixedIndexRIDContainerSerializer.java b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/stream/OMixedIndexRIDContainerSerializer.java index e482b645ed1..16f681a22fb 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/stream/OMixedIndexRIDContainerSerializer.java +++ b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/stream/OMixedIndexRIDContainerSerializer.java @@ -18,6 +18,7 @@ public class OMixedIndexRIDContainerSerializer implements OBinarySerializer { + public static final OMixedIndexRIDContainerSerializer INSTANCE = new OMixedIndexRIDContainerSerializer(); @@ -299,11 +300,58 @@ public OMixedIndexRIDContainer deserializeFromByteBufferObject(ByteBuffer buffer return new OMixedIndexRIDContainer(fileId, hashSet, tree); } + @Override + public OMixedIndexRIDContainer deserializeFromByteBufferObject( + final int bufferOffset, final ByteBuffer buffer) { + var currentPosition = bufferOffset + Integer.BYTES; + final long fileId = buffer.getLong(currentPosition); + currentPosition += Long.BYTES; + + final int embeddedSize = buffer.getInt(currentPosition); + currentPosition += Integer.BYTES; + + final Set hashSet = new HashSet<>(); + for (int i = 0; i < embeddedSize; i++) { + var delta = + OCompactedLinkSerializer.INSTANCE.getObjectSizeInByteBuffer(currentPosition, buffer); + final ORID orid = + OCompactedLinkSerializer.INSTANCE + .deserializeFromByteBufferObject(currentPosition, buffer) + .getIdentity(); + currentPosition += delta; + + hashSet.add(orid); + } + + final long pageIndex = buffer.getLong(currentPosition); + currentPosition += Long.BYTES; + + final int offset = buffer.getInt(currentPosition); + final OIndexRIDContainerSBTree tree; + if (pageIndex == -1) { + tree = null; + } else { + final ODatabaseDocumentInternal db = ODatabaseRecordThreadLocal.instance().get(); + tree = + new OIndexRIDContainerSBTree( + fileId, + new OBonsaiBucketPointer(pageIndex, offset), + (OAbstractPaginatedStorage) db.getStorage()); + } + + return new OMixedIndexRIDContainer(fileId, hashSet, tree); + } + @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return buffer.getInt(); } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return buffer.getInt(offset); + } + @Override public OMixedIndexRIDContainer deserializeFromByteBufferObject( ByteBuffer buffer, OWALChanges walChanges, int offset) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerRID.java b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerRID.java index 4a9cc2d1d48..d7770e9efcf 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerRID.java +++ b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerRID.java @@ -89,12 +89,22 @@ public OIdentifiable deserializeFromByteBufferObject(ByteBuffer buffer) { return OLinkSerializer.INSTANCE.deserializeFromByteBufferObject(buffer); } + @Override + public OIdentifiable deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + return OLinkSerializer.INSTANCE.deserializeFromByteBufferObject(offset, buffer); + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return OLinkSerializer.INSTANCE.getObjectSizeInByteBuffer(buffer); } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return OLinkSerializer.INSTANCE.getObjectSizeInByteBuffer(offset, buffer); + } + /** {@inheritDoc} */ @Override public OIdentifiable deserializeFromByteBufferObject( diff --git a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerSBTreeIndexRIDContainer.java b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerSBTreeIndexRIDContainer.java index 9f0aede591f..f7c6d63fe78 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerSBTreeIndexRIDContainer.java +++ b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerSBTreeIndexRIDContainer.java @@ -141,8 +141,7 @@ public OIndexRIDContainer deserializeNativeObject(byte[] stream, int offset) { if (BOOLEAN_SERIALIZER.deserializeNative(stream, offset + EMBEDDED_OFFSET)) { final int size = INT_SERIALIZER.deserializeNative(stream, offset + EMBEDDED_SIZE_OFFSET); - final Set underlying = - new HashSet(Math.max((int) (size / .75f) + 1, 16)); + final Set underlying = new HashSet<>(Math.max((int) (size / .75f) + 1, 16)); int p = offset + EMBEDDED_VALUES_OFFSET; for (int i = 0; i < size; i++) { @@ -218,8 +217,7 @@ public OIndexRIDContainer deserializeFromByteBufferObject(ByteBuffer buffer) { if (embedded) { final int size = buffer.getInt(); - final Set underlying = - new HashSet(Math.max((int) (size / .75f) + 1, 16)); + final Set underlying = new HashSet<>(Math.max((int) (size / .75f) + 1, 16)); for (int i = 0; i < size; i++) { underlying.add(LINK_SERIALIZER.deserializeFromByteBufferObject(buffer)); @@ -239,11 +237,59 @@ public OIndexRIDContainer deserializeFromByteBufferObject(ByteBuffer buffer) { } } + @Override + public OIndexRIDContainer deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + final long fileId = buffer.getLong(offset); + offset += Long.BYTES; + + final boolean embedded = buffer.get(offset) > 0; + offset++; + + final boolean durable = buffer.get(offset) > 0; + offset++; + + if (embedded) { + final int size = buffer.getInt(offset); + offset += Integer.BYTES; + + final Set underlying = new HashSet<>(Math.max((int) (size / .75f) + 1, 16)); + + for (int i = 0; i < size; i++) { + var delta = LINK_SERIALIZER.getObjectSizeInByteBuffer(offset, buffer); + underlying.add(LINK_SERIALIZER.deserializeFromByteBufferObject(offset, buffer)); + offset += delta; + } + + return new OIndexRIDContainer(fileId, underlying, durable); + } else { + final long pageIndex = buffer.getLong(offset); + offset += Long.BYTES; + + final int pageOffset = buffer.getInt(offset); + + final OBonsaiBucketPointer rootPointer = new OBonsaiBucketPointer(pageIndex, pageOffset); + final ODatabaseDocumentInternal db = ODatabaseRecordThreadLocal.instance().get(); + final OIndexRIDContainerSBTree underlying = + new OIndexRIDContainerSBTree( + fileId, rootPointer, (OAbstractPaginatedStorage) db.getStorage()); + return new OIndexRIDContainer(fileId, underlying, durable); + } + } + /** {@inheritDoc} */ @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { final int offset = buffer.position(); - buffer.position(); + + if (buffer.get(offset + EMBEDDED_OFFSET) > 0) { + return embeddedObjectSerializedSize(buffer.getInt(offset + EMBEDDED_SIZE_OFFSET)); + } else { + return SBTREE_CONTAINER_SIZE; + } + } + + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { if (buffer.get(offset + EMBEDDED_OFFSET) > 0) { return embeddedObjectSerializedSize(buffer.getInt(offset + EMBEDDED_SIZE_OFFSET)); } else { @@ -260,8 +306,7 @@ public OIndexRIDContainer deserializeFromByteBufferObject( if (walChanges.getByteValue(buffer, offset + EMBEDDED_OFFSET) > 0) { final int size = walChanges.getIntValue(buffer, offset + EMBEDDED_SIZE_OFFSET); - final Set underlying = - new HashSet(Math.max((int) (size / .75f) + 1, 16)); + final Set underlying = new HashSet<>(Math.max((int) (size / .75f) + 1, 16)); int p = offset + EMBEDDED_VALUES_OFFSET; for (int i = 0; i < size; i++) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/string/OStringSerializerAnyStreamable.java b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/string/OStringSerializerAnyStreamable.java index 95f9f8b757e..ca67e628b7f 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/string/OStringSerializerAnyStreamable.java +++ b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/string/OStringSerializerAnyStreamable.java @@ -72,7 +72,8 @@ public StringBuilder toStream(final StringBuilder iOutput, Object iValue) { if (iValue != null) { if (!(iValue instanceof OSerializableStream)) throw new OSerializationException( - "Cannot serialize the object since it's not implements the OSerializableStream interface"); + "Cannot serialize the object since it's not implements the OSerializableStream" + + " interface"); OSerializableStream stream = (OSerializableStream) iValue; iOutput.append(iValue.getClass().getName()); diff --git a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/string/OStringSerializerEmbedded.java b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/string/OStringSerializerEmbedded.java index f582846a8f6..956c199fe88 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/string/OStringSerializerEmbedded.java +++ b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/string/OStringSerializerEmbedded.java @@ -98,7 +98,8 @@ public StringBuilder toStream(final StringBuilder iOutput, Object iValue) { if (!(iValue instanceof OSerializableStream)) throw new OSerializationException( - "Cannot serialize the object since it's not implements the OSerializableStream interface"); + "Cannot serialize the object since it's not implements the OSerializableStream" + + " interface"); OSerializableStream stream = (OSerializableStream) iValue; iOutput.append(iValue.getClass().getName()); diff --git a/core/src/main/java/com/orientechnologies/orient/core/sharding/auto/OAutoShardingClusterSelectionStrategy.java b/core/src/main/java/com/orientechnologies/orient/core/sharding/auto/OAutoShardingClusterSelectionStrategy.java index ca271bf82c3..526a16a0bb7 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sharding/auto/OAutoShardingClusterSelectionStrategy.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sharding/auto/OAutoShardingClusterSelectionStrategy.java @@ -70,7 +70,8 @@ public OAutoShardingClusterSelectionStrategy(final OClass clazz, final OIndex au } catch (OInvalidIndexEngineIdException e) { throw OException.wrapException( new OConfigurationException( - "Cannot use auto-sharding cluster strategy because the underlying index has not found"), + "Cannot use auto-sharding cluster strategy because the underlying index has not" + + " found"), e); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/shutdown/OShutdownHandler.java b/core/src/main/java/com/orientechnologies/orient/core/shutdown/OShutdownHandler.java index d7c7fb071da..7d31f325e22 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/shutdown/OShutdownHandler.java +++ b/core/src/main/java/com/orientechnologies/orient/core/shutdown/OShutdownHandler.java @@ -32,7 +32,9 @@ public interface OShutdownHandler { /** Priority of com.orientechnologies.orient.core.Orient.OShutdownCallListenersHandler handler. */ int SHUTDOWN_CALL_LISTENERS = 1400; - /** @return Handlers priority. */ + /** + * @return Handlers priority. + */ int getPriority(); /** diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLAlterClass.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLAlterClass.java index efc0738c2c8..204f3b436cc 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLAlterClass.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLAlterClass.java @@ -155,7 +155,8 @@ public Object execute(final Map iArgs) { throw new OCommandExecutionException( "Cannot alter class '" + className - + "' because is an Edge class and could break vertices. Use UNSAFE if you want to force it"); + + "' because is an Edge class and could break vertices. Use UNSAFE if you want to" + + " force it"); if (value != null && attribute == ATTRIBUTES.SUPERCLASS) { checkClassExists(database, className, decodeClassName(value)); @@ -171,7 +172,8 @@ public Object execute(final Map iArgs) { throw new OCommandExecutionException( "Cannot rename class '" + className - + "' because it has indexes defined on it. Drop indexes before or use UNSAFE (at your won risk)"); + + "' because it has indexes defined on it. Drop indexes before or use UNSAFE (at" + + " your won risk)"); } } cls.set(attribute, value); diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateClass.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateClass.java index e1c332b3189..2c30637d412 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateClass.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateClass.java @@ -290,7 +290,8 @@ public Object execute(final Map iArgs) { @Override public String getSyntax() { - return "CREATE CLASS [IF NOT EXISTS] [EXTENDS [,*] ] [CLUSTER *] [CLUSTERS ] [ABSTRACT]"; + return "CREATE CLASS [IF NOT EXISTS] [EXTENDS [,*] ]" + + " [CLUSTER *] [CLUSTERS ] [ABSTRACT]"; } @Override diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateEdge.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateEdge.java index 0785cdc6325..a9e7ea64e0f 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateEdge.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateEdge.java @@ -119,7 +119,9 @@ public OCommandExecutorSQLCreateEdge parse(final OCommandRequest iRequest) { this, "Requested command '" + this.toString() - + "' must be executed outside active transaction: the transaction will be committed and reopen right after it. To avoid this behavior execute it outside a transaction"); + + "' must be executed outside active transaction: the transaction will be" + + " committed and reopen right after it. To avoid this behavior execute" + + " it outside a transaction"); committed = database.getTransaction().amountOfNestedTxs(); database.commit(true); } else committed = 0; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateFunction.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateFunction.java index 212812da7a9..61e85f01575 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateFunction.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateFunction.java @@ -121,6 +121,7 @@ public Object execute(final Map iArgs) { @Override public String getSyntax() { - return "CREATE FUNCTION [PARAMETERS []] [IDEMPOTENT true|false] [LANGUAGE ]"; + return "CREATE FUNCTION [PARAMETERS []]" + + " [IDEMPOTENT true|false] [LANGUAGE ]"; } } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateIndex.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateIndex.java index 7b425ca59a5..d52d26b3ea7 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateIndex.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateIndex.java @@ -305,7 +305,8 @@ else if (serializerKeyId != 0) { engine); } else { throw new ODatabaseException( - "Impossible to create an index without specify the key type or the associated property"); + "Impossible to create an index without specify the key type or the associated" + + " property"); } } else { if ((keyTypes == null || keyTypes.length == 0) && collates == null) { @@ -367,7 +368,8 @@ public QUORUM_TYPE getQuorumType() { @Override public String getSyntax() { - return "CREATE INDEX [ON (prop-names [COLLATE ])] [] [ENGINE ] [METADATA {JSON Index Metadata Document}]"; + return "CREATE INDEX [ON (prop-names [COLLATE ])] " + + " [] [ENGINE ] [METADATA {JSON Index Metadata Document}]"; } private OClass findClass(String part) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateLink.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateLink.java index d046651d382..1e6ae4d5229 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateLink.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateLink.java @@ -351,6 +351,7 @@ else if (result.size() > 1) @Override public String getSyntax() { - return "CREATE LINK [TYPE ] FROM . TO . [INVERSE]"; + return "CREATE LINK [TYPE ] FROM . TO" + + " . [INVERSE]"; } } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateProperty.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateProperty.java index edc329f447f..d8bdcf65082 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateProperty.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateProperty.java @@ -358,8 +358,8 @@ public String getUndoCommand() { @Override public String getSyntax() { - return "CREATE PROPERTY . [IF NOT EXISTS] [|] " - + "[(mandatory , notnull , , default , min , max )] " - + "[UNSAFE]"; + return "CREATE PROPERTY . [IF NOT EXISTS] " + + " [|] [(mandatory , notnull ," + + " , default , min , max )] [UNSAFE]"; } } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateSequence.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateSequence.java index 57a7175bdb8..753d71a03a5 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateSequence.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateSequence.java @@ -113,7 +113,8 @@ public Object execute(Map iArgs) { @Override public String getSyntax() { - return "CREATE SEQUENCE [TYPE ] [START ] [INCREMENT ] [CACHE ]"; + return "CREATE SEQUENCE [TYPE ] [START ] [INCREMENT ]" + + " [CACHE ]"; } @Override diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLDelete.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLDelete.java index f7b9516c461..158adf981ae 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLDelete.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLDelete.java @@ -334,11 +334,13 @@ public boolean result(final Object iRecord) { if (cls.isSubClassOf("V")) // FOUND VERTEX throw new OCommandExecutionException( - "'DELETE' command cannot delete vertices. Use 'DELETE VERTEX' command instead, or apply the 'UNSAFE' keyword to force it"); + "'DELETE' command cannot delete vertices. Use 'DELETE VERTEX' command instead, or" + + " apply the 'UNSAFE' keyword to force it"); else if (cls.isSubClassOf("E")) // FOUND EDGE throw new OCommandExecutionException( - "'DELETE' command cannot delete edges. Use 'DELETE EDGE' command instead, or apply the 'UNSAFE' keyword to force it"); + "'DELETE' command cannot delete edges. Use 'DELETE EDGE' command instead, or" + + " apply the 'UNSAFE' keyword to force it"); } } @@ -356,7 +358,8 @@ else if (cls.isSubClassOf("E")) } public String getSyntax() { - return "DELETE FROM |RID|cluster: [UNSAFE] [LOCK ] [RETURN ] [WHERE *]"; + return "DELETE FROM |RID|cluster: [UNSAFE] [LOCK ] [RETURN" + + " ] [WHERE *]"; } @Override diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLDeleteEdge.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLDeleteEdge.java index 951d5e3d31a..3e3d65e8af1 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLDeleteEdge.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLDeleteEdge.java @@ -381,7 +381,8 @@ private OVertex toVertex(OIdentifiable item) { @Override public String getSyntax() { - return "DELETE EDGE |FROM |TO |<[] [WHERE ]> [BATCH ]"; + return "DELETE EDGE |FROM |TO |<[] [WHERE ]> [BATCH" + + " ]"; } @Override diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLDeleteVertex.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLDeleteVertex.java index d666a33be8c..234e0e656f0 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLDeleteVertex.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLDeleteVertex.java @@ -247,7 +247,8 @@ public long getDistributedTimeout() { @Override public String getSyntax() { - return "DELETE VERTEX ||FROM [WHERE ] [LIMIT ] [RETURN ]> [BATCH ]"; + return "DELETE VERTEX ||FROM [WHERE ] [LIMIT ]" + + " [RETURN ]> [BATCH ]"; } @Override diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLDropClass.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLDropClass.java index 681cf3f92cd..278d67ed8c3 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLDropClass.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLDropClass.java @@ -146,13 +146,15 @@ public Object execute(final Map iArgs) { throw new OCommandExecutionException( "'DROP CLASS' command cannot drop class '" + className - + "' because it contains Vertices. Use 'DELETE VERTEX' command first to avoid broken edges in a database, or apply the 'UNSAFE' keyword to force it"); + + "' because it contains Vertices. Use 'DELETE VERTEX' command first to avoid" + + " broken edges in a database, or apply the 'UNSAFE' keyword to force it"); } else if (cls.isSubClassOf("E")) { // FOUND EDGE CLASS throw new OCommandExecutionException( "'DROP CLASS' command cannot drop class '" + className - + "' because it contains Edges. Use 'DELETE EDGE' command first to avoid broken vertices in a database, or apply the 'UNSAFE' keyword to force it"); + + "' because it contains Edges. Use 'DELETE EDGE' command first to avoid broken" + + " vertices in a database, or apply the 'UNSAFE' keyword to force it"); } } @@ -166,7 +168,8 @@ public Object execute(final Map iArgs) { OLogManager.instance() .warn( this, - "Dropped class '%s' containing %d vertices using UNSAFE mode. Database could contain broken edges", + "Dropped class '%s' containing %d vertices using UNSAFE mode. Database could" + + " contain broken edges", className, records); } else if (cls.isSubClassOf("E")) { @@ -174,7 +177,8 @@ public Object execute(final Map iArgs) { OLogManager.instance() .warn( this, - "Dropped class '%s' containing %d edges using UNSAFE mode. Database could contain broken vertices", + "Dropped class '%s' containing %d edges using UNSAFE mode. Database could contain" + + " broken vertices", className, records); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLFactory.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLFactory.java index 081c8d520ee..53beea11fd0 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLFactory.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLFactory.java @@ -26,7 +26,9 @@ */ public interface OCommandExecutorSQLFactory { - /** @return Set of supported command names of this factory */ + /** + * @return Set of supported command names of this factory + */ Set getCommandNames(); /** diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLInsert.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLInsert.java index 69c75987f79..98c60d806cb 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLInsert.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLInsert.java @@ -125,7 +125,8 @@ else if (subjectNameUpper.startsWith(OCommandExecutorSQLAbstract.INDEX_PREFIX)) if (!unsafe && cls.isSubClassOf("E")) // FOUND EDGE throw new OCommandExecutionException( - "'INSERT' command cannot create Edges. Use 'CREATE EDGE' command instead, or apply the 'UNSAFE' keyword to force it"); + "'INSERT' command cannot create Edges. Use 'CREATE EDGE' command instead, or apply" + + " the 'UNSAFE' keyword to force it"); className = cls.getName(); clazz = database.getMetadata().getSchema().getClass(className); @@ -288,9 +289,9 @@ public Set getInvolvedClusters() { @Override public String getSyntax() { - return "INSERT INTO [class:]|cluster:|index: " - + "[([,]*) VALUES ([,]*)[,]*]|[SET = |[,]*]|CONTENT {} " - + "[RETURN ] [FROM select-query]"; + return "INSERT INTO [class:]|cluster:|index: [([,]*) VALUES" + + " ([,]*)[,]*]|[SET = |[,]*]|CONTENT" + + " {} [RETURN ] [FROM select-query]"; } @Override diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLLiveSelect.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLLiveSelect.java index 66864941886..ca3470334fe 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLLiveSelect.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLLiveSelect.java @@ -45,7 +45,9 @@ import java.util.Map; import java.util.Random; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OCommandExecutorSQLLiveSelect extends OCommandExecutorSQLSelect implements OLiveQueryListener { public static final String KEYWORD_LIVE_SELECT = "LIVE SELECT"; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLLiveUnsubscribe.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLLiveUnsubscribe.java index 4bf3838ede8..a112cc687c8 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLLiveUnsubscribe.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLLiveUnsubscribe.java @@ -30,7 +30,9 @@ import java.util.Locale; import java.util.Map; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OCommandExecutorSQLLiveUnsubscribe extends OCommandExecutorSQLAbstract implements OCommandDistributedReplicateRequest { public static final String KEYWORD_LIVE_UNSUBSCRIBE = "LIVE UNSUBSCRIBE"; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLMoveVertex.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLMoveVertex.java index 0165b2f8139..613d006495f 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLMoveVertex.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLMoveVertex.java @@ -192,7 +192,8 @@ public QUORUM_TYPE getQuorumType() { @Override public String getSyntax() { - return "MOVE VERTEX TO [SET [=]* [,]] [MERGE ] [BATCH ]"; + return "MOVE VERTEX TO [SET [=]* [,]] [MERGE ]" + + " [BATCH ]"; } private OVertex toVertex(OIdentifiable item) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLResultsetAbstract.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLResultsetAbstract.java index 6ce87bb5c04..2f13bf0dfc3 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLResultsetAbstract.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLResultsetAbstract.java @@ -105,8 +105,12 @@ private IndexValuesIterator(String indexName, boolean ascOrder) { final ODatabaseDocumentInternal database = getDatabase(); if (ascOrder) { indexValuesIterator = - database.getMetadata().getIndexManagerInternal().getIndex(database, indexName) - .getInternal().stream() + database + .getMetadata() + .getIndexManagerInternal() + .getIndex(database, indexName) + .getInternal() + .stream() .map((pair) -> pair.second) .iterator(); } else @@ -344,7 +348,8 @@ protected int parseLimit(final String w) throws OCommandSQLParsingException { if (limit == 0) throwParsingException( - "Invalid LIMIT value setted to ZERO. Use -1 to ignore the limit or use a positive number. Example: LIMIT 10"); + "Invalid LIMIT value setted to ZERO. Use -1 to ignore the limit or use a positive number." + + " Example: LIMIT 10"); return limit; } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLSelect.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLSelect.java index 4b6ab933727..a44eab44712 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLSelect.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLSelect.java @@ -539,7 +539,9 @@ public Map getProjections() { @Override public String getSyntax() { - return "SELECT [] FROM [LET *] [WHERE *] [ORDER BY * [ASC|DESC]*] [LIMIT ] [TIMEOUT ] [LOCK none|record] [NOCACHE]"; + return "SELECT [] FROM [LET *] [WHERE *] [ORDER BY" + + " * [ASC|DESC]*] [LIMIT ] [TIMEOUT ] [LOCK" + + " none|record] [NOCACHE]"; } public String getFetchPlan() { @@ -774,7 +776,9 @@ protected boolean addResult(OIdentifiable iRecord, final OCommandContext iContex if (tipLimitThreshold > 0 && resultCount > tipLimitThreshold && getLimit() == -1) { reportTip( String.format( - "Query '%s' returned a result set with more than %d records. Check if you really need all these records, or reduce the resultset by using a LIMIT to improve both performance and used RAM", + "Query '%s' returned a result set with more than %d records. Check if you really need" + + " all these records, or reduce the resultset by using a LIMIT to improve both" + + " performance and used RAM", parserText, tipLimitThreshold)); tipLimitThreshold = 0; } @@ -1170,7 +1174,8 @@ protected int parseProjections() { List pars = OStringSerializerHelper.getParameters(projection); if (pars.size() != 1) throw new OCommandSQLParsingException( - "EXPAND/FLATTEN operators expects the field name as parameter. Example EXPAND( out )"); + "EXPAND/FLATTEN operators expects the field name as parameter. Example EXPAND( out" + + " )"); expandTarget = OSQLHelper.parseValue(this, pars.get(0).trim(), context); @@ -1868,7 +1873,9 @@ private boolean execParallelWithPool( OLogManager.instance() .debug( this, - "Parallel query '%s' has result queue full (size=%d), this could reduce concurrency level. Consider increasing queue size with setting: %s=", + "Parallel query '%s' has result queue full (size=%d), this could reduce" + + " concurrency level. Consider increasing queue size with setting:" + + " %s=", parserText, maxQueueSize + 1, OGlobalConfiguration.QUERY_PARALLEL_RESULT_QUEUE_SIZE.getKey()); @@ -2183,7 +2190,8 @@ private List>> getIndexCursors(final OClass iSchem OLogManager.instance() .error( this, - "Error on using index %s in query '%s'. Probably you need to rebuild indexes. Now executing query using cluster scan", + "Error on using index %s in query '%s'. Probably you need to rebuild indexes." + + " Now executing query using cluster scan", e, index.getName(), request != null && request.getText() != null ? request.getText() : ""); @@ -2345,7 +2353,8 @@ private boolean searchForIndexes(final OClass iSchemaClass) { OLogManager.instance() .error( this, - "Error on using index %s in query '%s'. Probably you need to rebuild indexes. Now executing query using cluster scan", + "Error on using index %s in query '%s'. Probably you need to rebuild indexes." + + " Now executing query using cluster scan", e, index.getName(), request != null && request.getText() != null ? request.getText() : ""); diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLSetAware.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLSetAware.java index 22fc3ae7df5..060b7b4ae96 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLSetAware.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLSetAware.java @@ -34,7 +34,9 @@ import java.util.Map; import java.util.Set; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public abstract class OCommandExecutorSQLSetAware extends OCommandExecutorSQLAbstract { protected static final String KEYWORD_SET = "SET"; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLTraverse.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLTraverse.java index 2323210ae07..f3a8902c6b6 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLTraverse.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLTraverse.java @@ -213,14 +213,17 @@ public Iterator iterator(final Map iArgs) { } public String getSyntax() { - return "TRAVERSE * FROM [MAXDEPTH ] [WHILE ] [STRATEGY ]"; + return "TRAVERSE * FROM [MAXDEPTH ] [WHILE ] [STRATEGY" + + " ]"; } protected void warnDeprecatedWhere() { OLogManager.instance() .warn( this, - "Keyword WHERE in traverse has been replaced by WHILE. Please change your query to support WHILE instead of WHERE because now it's only deprecated, but in future it will be removed the back-ward compatibility."); + "Keyword WHERE in traverse has been replaced by WHILE. Please change your query to" + + " support WHILE instead of WHERE because now it's only deprecated, but in future" + + " it will be removed the back-ward compatibility."); } @Override diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLTruncateClass.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLTruncateClass.java index 471c34ed514..5766229a2bf 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLTruncateClass.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLTruncateClass.java @@ -118,10 +118,12 @@ public Object execute(final Map iArgs) { if (recs > 0 && !unsafe) { if (schemaClass.isSubClassOf("V")) { throw new OCommandExecutionException( - "'TRUNCATE CLASS' command cannot be used on not empty vertex classes. Apply the 'UNSAFE' keyword to force it (at your own risk)"); + "'TRUNCATE CLASS' command cannot be used on not empty vertex classes. Apply the" + + " 'UNSAFE' keyword to force it (at your own risk)"); } else if (schemaClass.isSubClassOf("E")) { throw new OCommandExecutionException( - "'TRUNCATE CLASS' command cannot be used on not empty edge classes. Apply the 'UNSAFE' keyword to force it (at your own risk)"); + "'TRUNCATE CLASS' command cannot be used on not empty edge classes. Apply the 'UNSAFE'" + + " keyword to force it (at your own risk)"); } } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLUpdate.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLUpdate.java index 8676e8c2167..5d7d9a058eb 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLUpdate.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLUpdate.java @@ -488,8 +488,9 @@ private void validateOutInForEdge(ODocument record, Object currentOut, Object cu @Override public String getSyntax() { - return "UPDATE |cluster:> [SET|ADD|PUT|REMOVE|INCREMENT|CONTENT {}|MERGE {}] [[,] = |]* [LOCK ] " - + "[UPSERT] [RETURN ] [WHERE ]"; + return "UPDATE |cluster:> [SET|ADD|PUT|REMOVE|INCREMENT|CONTENT {}|MERGE" + + " {}] [[,] = |]* [LOCK ]" + + " [UPSERT] [RETURN ] [WHERE ]"; } @Override diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/ODefaultCommandExecutorSQLFactory.java b/core/src/main/java/com/orientechnologies/orient/core/sql/ODefaultCommandExecutorSQLFactory.java index aeb92ae63bc..04ca17e866b 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/ODefaultCommandExecutorSQLFactory.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/ODefaultCommandExecutorSQLFactory.java @@ -212,7 +212,8 @@ public OCommandExecutor createCommand(final String name) throws OCommandExecutio new OCommandExecutionException( "Error in creation of command " + name - + "(). Probably there is not an empty constructor or the constructor generates errors"), + + "(). Probably there is not an empty constructor or the constructor generates" + + " errors"), e); } } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/ODynamicSQLElementFactory.java b/core/src/main/java/com/orientechnologies/orient/core/sql/ODynamicSQLElementFactory.java index ce44feaa0dc..7a589c31163 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/ODynamicSQLElementFactory.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/ODynamicSQLElementFactory.java @@ -69,7 +69,8 @@ public OSQLFunction createFunction(final String name) throws OCommandExecutionEx new OCommandExecutionException( "Error in creation of function " + name - + "(). Probably there is not an empty constructor or the constructor generates errors"), + + "(). Probably there is not an empty constructor or the constructor generates" + + " errors"), e); } } @@ -92,7 +93,8 @@ public OCommandExecutorSQLAbstract createCommand(final String name) new OCommandExecutionException( "Error in creation of command " + name - + "(). Probably there is not an empty constructor or the constructor generates errors"), + + "(). Probably there is not an empty constructor or the constructor generates" + + " errors"), e); } } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OFilterAnalyzer.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OFilterAnalyzer.java index 7002c9ab801..09ead7d7a77 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OFilterAnalyzer.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OFilterAnalyzer.java @@ -40,7 +40,9 @@ import java.util.List; import java.util.Set; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public class OFilterAnalyzer { public List getInvolvedIndexes( diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OIterableRecordSource.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OIterableRecordSource.java index 08f6e1ee108..48f5fe66b78 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OIterableRecordSource.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OIterableRecordSource.java @@ -24,7 +24,9 @@ import java.util.Iterator; import java.util.Map; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public interface OIterableRecordSource { Iterator iterator(final Map iArgs); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OLiveCommandExecutorSQLFactory.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OLiveCommandExecutorSQLFactory.java index 13c47480291..fbd1eedefe5 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OLiveCommandExecutorSQLFactory.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OLiveCommandExecutorSQLFactory.java @@ -80,7 +80,8 @@ public OCommandExecutorSQLAbstract createCommand(final String name) new OCommandExecutionException( "Error in creation of command " + name - + "(). Probably there is not an empty constructor or the constructor generates errors"), + + "(). Probably there is not an empty constructor or the constructor generates" + + " errors"), e); } } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OMetricRecorder.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OMetricRecorder.java index 50a6ee22ca6..36be01d5715 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OMetricRecorder.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OMetricRecorder.java @@ -25,7 +25,9 @@ import java.util.HashSet; import java.util.Set; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public class OMetricRecorder { protected OCommandContext context; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OOrderByOptimizer.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OOrderByOptimizer.java index 5b74ef2c08b..cf4f79afffe 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OOrderByOptimizer.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OOrderByOptimizer.java @@ -25,7 +25,9 @@ import com.orientechnologies.orient.core.index.OIndexDefinition; import java.util.List; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public class OOrderByOptimizer { boolean canBeUsedByOrderBy(OIndex index, List> orderedFields) { if (orderedFields.isEmpty()) return false; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OOriginalRecordsReturnHandler.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OOriginalRecordsReturnHandler.java index 1e6e58eeee7..cc311700b60 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OOriginalRecordsReturnHandler.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OOriginalRecordsReturnHandler.java @@ -23,7 +23,9 @@ import com.orientechnologies.orient.core.command.OCommandContext; import com.orientechnologies.orient.core.record.impl.ODocument; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public class OOriginalRecordsReturnHandler extends ORecordsReturnHandler { public OOriginalRecordsReturnHandler(Object returnExpression, OCommandContext context) { super(returnExpression, context); diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/ORecordCountHandler.java b/core/src/main/java/com/orientechnologies/orient/core/sql/ORecordCountHandler.java index 502f8b86e4c..511ef3e47ce 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/ORecordCountHandler.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/ORecordCountHandler.java @@ -22,7 +22,9 @@ import com.orientechnologies.orient.core.record.impl.ODocument; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public class ORecordCountHandler implements OReturnHandler { private int count = 0; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/ORecordsReturnHandler.java b/core/src/main/java/com/orientechnologies/orient/core/sql/ORecordsReturnHandler.java index c44a1703536..2dc583d4b85 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/ORecordsReturnHandler.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/ORecordsReturnHandler.java @@ -26,7 +26,9 @@ import java.util.ArrayList; import java.util.List; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public abstract class ORecordsReturnHandler implements OReturnHandler { private final Object returnExpression; private final OCommandContext context; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OReturnHandler.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OReturnHandler.java index dcedb57dba1..6406bca9da9 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OReturnHandler.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OReturnHandler.java @@ -22,7 +22,9 @@ import com.orientechnologies.orient.core.record.impl.ODocument; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public interface OReturnHandler { void reset(); @@ -30,6 +32,8 @@ public interface OReturnHandler { void afterUpdate(ODocument result); - /** @return collected result */ + /** + * @return collected result + */ Object ret(); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OSQLEngine.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OSQLEngine.java index 7117d636764..0f1593d64bb 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OSQLEngine.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OSQLEngine.java @@ -155,7 +155,9 @@ public static void registerOperator(final OQueryOperator iOperator) { SORTED_OPERATORS = null; // clear cache } - /** @return Iterator of all function factories */ + /** + * @return Iterator of all function factories + */ public static Iterator getFunctionFactories() { if (FUNCTION_FACTORIES == null) { synchronized (INSTANCE) { @@ -193,7 +195,9 @@ public static Iterator getMethodFactories() { return METHOD_FACTORIES.iterator(); } - /** @return Iterator of all function factories */ + /** + * @return Iterator of all function factories + */ public static Iterator getCollateFactories() { if (COLLATE_FACTORIES == null) { synchronized (INSTANCE) { @@ -213,7 +217,9 @@ public static Iterator getCollateFactories() { return COLLATE_FACTORIES.iterator(); } - /** @return Iterator of all operator factories */ + /** + * @return Iterator of all operator factories + */ public static Iterator getOperatorFactories() { if (OPERATOR_FACTORIES == null) { synchronized (INSTANCE) { @@ -233,7 +239,9 @@ public static Iterator getOperatorFactories() { return OPERATOR_FACTORIES.iterator(); } - /** @return Iterator of all command factories */ + /** + * @return Iterator of all command factories + */ public static Iterator getCommandFactories() { if (EXECUTOR_FACTORIES == null) { synchronized (INSTANCE) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/OUpdatedRecordsReturnHandler.java b/core/src/main/java/com/orientechnologies/orient/core/sql/OUpdatedRecordsReturnHandler.java index d0565c60081..911546ac31e 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/OUpdatedRecordsReturnHandler.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/OUpdatedRecordsReturnHandler.java @@ -23,7 +23,9 @@ import com.orientechnologies.orient.core.command.OCommandContext; import com.orientechnologies.orient.core.record.impl.ODocument; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public class OUpdatedRecordsReturnHandler extends ORecordsReturnHandler { public OUpdatedRecordsReturnHandler(Object returnExpression, OCommandContext context) { super(returnExpression, context); diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/AbstractExecutionStep.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/AbstractExecutionStep.java index 5231d68537f..150b19c6695 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/AbstractExecutionStep.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/AbstractExecutionStep.java @@ -7,7 +7,9 @@ import java.text.DecimalFormat; import java.util.Optional; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public abstract class AbstractExecutionStep implements OExecutionStepInternal { protected final OCommandContext ctx; @@ -78,7 +80,8 @@ public OExecutionStream start(OCommandContext ctx) throws OTimeoutException { } else { return internalStart(ctx); } - }; + } + ; protected abstract OExecutionStream internalStart(OCommandContext ctx) throws OTimeoutException; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/CreateRecordStep.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/CreateRecordStep.java index 0a19e8df470..c83d3819a59 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/CreateRecordStep.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/CreateRecordStep.java @@ -6,7 +6,9 @@ import com.orientechnologies.orient.core.sql.executor.resultset.OExecutionStream; import com.orientechnologies.orient.core.sql.executor.resultset.OProduceExecutionStream; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class CreateRecordStep extends AbstractExecutionStep { private int total = 0; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/FetchFromClusterExecutionStep.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/FetchFromClusterExecutionStep.java index 0d728b663dc..f7e9561d933 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/FetchFromClusterExecutionStep.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/FetchFromClusterExecutionStep.java @@ -19,7 +19,9 @@ import com.orientechnologies.orient.core.sql.parser.ORid; import java.util.Iterator; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class FetchFromClusterExecutionStep extends AbstractExecutionStep { public static final Object ORDER_ASC = "ASC"; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/InsertValuesStep.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/InsertValuesStep.java index 81d3e1bb0fa..f5665c50987 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/InsertValuesStep.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/InsertValuesStep.java @@ -46,7 +46,8 @@ public OResult map(OResult result, OCommandContext ctx) { List currentValues = values.get(nextValueSet++); if (currentValues.size() != identifiers.size()) { throw new OCommandExecutionException( - "Cannot execute INSERT, the number of fields is different from the number of expressions: " + "Cannot execute INSERT, the number of fields is different from the number of" + + " expressions: " + identifiers + " " + currentValues); diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/MatchStep.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/MatchStep.java index 668fb1c50a3..d1482307a22 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/MatchStep.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/MatchStep.java @@ -7,7 +7,9 @@ import com.orientechnologies.orient.core.sql.parser.OFieldMatchPathItem; import com.orientechnologies.orient.core.sql.parser.OMultiMatchPathItem; -/** @author Luigi Dell'Aquila */ +/** + * @author Luigi Dell'Aquila + */ public class MatchStep extends AbstractExecutionStep { protected final EdgeTraversal edge; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OCreateVertexExecutionPlanner.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OCreateVertexExecutionPlanner.java index 03f52b3ecc2..ff274c30b5a 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OCreateVertexExecutionPlanner.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OCreateVertexExecutionPlanner.java @@ -6,7 +6,9 @@ import java.util.ArrayList; import java.util.List; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OCreateVertexExecutionPlanner extends OInsertExecutionPlanner { public OCreateVertexExecutionPlanner(OCreateVertexStatement statement) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/ODDLExecutionPlan.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/ODDLExecutionPlan.java index c6d61f0c371..97fd54fd134 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/ODDLExecutionPlan.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/ODDLExecutionPlan.java @@ -8,7 +8,9 @@ import java.util.Collections; import java.util.List; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class ODDLExecutionPlan implements OInternalExecutionPlan { private final ODDLStatement statement; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/ODeleteExecutionPlan.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/ODeleteExecutionPlan.java index c3f5db0e173..b577503ee53 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/ODeleteExecutionPlan.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/ODeleteExecutionPlan.java @@ -2,7 +2,9 @@ import com.orientechnologies.orient.core.command.OCommandContext; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class ODeleteExecutionPlan extends OUpdateExecutionPlan { public ODeleteExecutionPlan(OCommandContext ctx) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OFindReferencesExecutionPlanner.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OFindReferencesExecutionPlanner.java index 6fa5e99f654..8b1b78e3b1c 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OFindReferencesExecutionPlanner.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OFindReferencesExecutionPlanner.java @@ -11,7 +11,9 @@ import java.util.List; import java.util.stream.Collectors; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OFindReferencesExecutionPlanner { protected ORid rid; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OForEachExecutionPlan.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OForEachExecutionPlan.java index cb8b1f925bc..9e1c0aea124 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OForEachExecutionPlan.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OForEachExecutionPlan.java @@ -4,7 +4,9 @@ import com.orientechnologies.orient.core.command.OCommandContext; import com.orientechnologies.orient.core.sql.parser.WhileStep; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OForEachExecutionPlan extends OUpdateExecutionPlan { public OForEachExecutionPlan(OCommandContext ctx) { super(ctx); diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OIfExecutionPlan.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OIfExecutionPlan.java index 52cb5919f45..edb1e0cee4b 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OIfExecutionPlan.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OIfExecutionPlan.java @@ -6,7 +6,9 @@ import java.util.Collections; import java.util.List; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OIfExecutionPlan implements OInternalExecutionPlan { private String location; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OInsertExecutionPlan.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OInsertExecutionPlan.java index 818b9400baa..2787d6593e2 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OInsertExecutionPlan.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OInsertExecutionPlan.java @@ -6,7 +6,9 @@ import java.util.ArrayList; import java.util.List; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OInsertExecutionPlan extends OSelectExecutionPlan { private List result = new ArrayList<>(); diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OMatchExecutionPlanner.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OMatchExecutionPlanner.java index 99c78e337f5..a487e4427fc 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OMatchExecutionPlanner.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OMatchExecutionPlanner.java @@ -156,7 +156,8 @@ public OInternalExecutionPlan createExecutionPlan( } if (groupBy != null) { throw new OCommandExecutionException( - "Cannot execute GROUP BY in MATCH query with RETURN $elements, $pathElements, $patterns or $paths"); + "Cannot execute GROUP BY in MATCH query with RETURN $elements, $pathElements, $patterns" + + " or $paths"); } if (this.orderBy != null) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/ORetryExecutionPlan.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/ORetryExecutionPlan.java index d9ac92a59b7..d6507cd4acb 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/ORetryExecutionPlan.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/ORetryExecutionPlan.java @@ -4,7 +4,9 @@ import com.orientechnologies.orient.core.command.OCommandContext; import com.orientechnologies.orient.core.sql.parser.WhileStep; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class ORetryExecutionPlan extends OUpdateExecutionPlan { public ORetryExecutionPlan(OCommandContext ctx) { super(ctx); diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/ORidSet.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/ORidSet.java index ee0ddfefc6d..79ec4db9d81 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/ORidSet.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/ORidSet.java @@ -35,7 +35,9 @@ public ORidSet() { this(Integer.MAX_VALUE / 10); } - /** @param bucketSize */ + /** + * @param bucketSize + */ public ORidSet(int bucketSize) { maxArraySize = bucketSize; } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OScriptExecutionPlan.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OScriptExecutionPlan.java index 2700df3cbc1..3b703c072ea 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OScriptExecutionPlan.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OScriptExecutionPlan.java @@ -7,7 +7,9 @@ import java.util.List; import java.util.stream.Collectors; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OScriptExecutionPlan implements OInternalExecutionPlan { private String location; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OSelectExecutionPlanner.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OSelectExecutionPlanner.java index f028d26b9fd..8167b690072 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OSelectExecutionPlanner.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OSelectExecutionPlanner.java @@ -74,7 +74,9 @@ import java.util.Set; import java.util.stream.Collectors; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OSelectExecutionPlanner { private QueryPlanningInfo info; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OSingleOpExecutionPlan.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OSingleOpExecutionPlan.java index 074018ccd42..1d6169a1c98 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OSingleOpExecutionPlan.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OSingleOpExecutionPlan.java @@ -8,7 +8,9 @@ import java.util.Collections; import java.util.List; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OSingleOpExecutionPlan implements OInternalExecutionPlan { protected final OSimpleExecStatement statement; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OSingleOpServerExecutionPlan.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OSingleOpServerExecutionPlan.java index 0fc3c147cc1..d0d65d517b7 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OSingleOpServerExecutionPlan.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OSingleOpServerExecutionPlan.java @@ -9,7 +9,9 @@ import java.util.Collections; import java.util.List; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OSingleOpServerExecutionPlan implements OInternalExecutionPlan { protected final OSimpleExecServerStatement statement; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OTraverseExecutionPlanner.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OTraverseExecutionPlanner.java index 2c934c7f72e..70cf6792e18 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OTraverseExecutionPlanner.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OTraverseExecutionPlanner.java @@ -32,7 +32,9 @@ import java.util.List; import java.util.stream.Collectors; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OTraverseExecutionPlanner { private List projections = null; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OUpdatableResult.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OUpdatableResult.java index 4fc3c4ad370..350fa256e37 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OUpdatableResult.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OUpdatableResult.java @@ -3,7 +3,9 @@ import com.orientechnologies.orient.core.db.record.OIdentifiable; import com.orientechnologies.orient.core.record.OElement; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OUpdatableResult extends OResultInternal { protected OResultInternal previousValue = null; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OUpdateExecutionPlan.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OUpdateExecutionPlan.java index c84ba72b38d..1858c042cff 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OUpdateExecutionPlan.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OUpdateExecutionPlan.java @@ -6,7 +6,9 @@ import java.util.ArrayList; import java.util.List; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OUpdateExecutionPlan extends OSelectExecutionPlan { private List result = new ArrayList<>(); diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/ParallelExecStep.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/ParallelExecStep.java index e6d565134c9..2f6f8c254b7 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/ParallelExecStep.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/ParallelExecStep.java @@ -7,7 +7,9 @@ import java.util.List; import java.util.stream.Collectors; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class ParallelExecStep extends AbstractExecutionStep { private final List subExecutionPlans; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/RemoveEmptyOptionalsStep.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/RemoveEmptyOptionalsStep.java index 09eaab34e2b..2537aa68811 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/RemoveEmptyOptionalsStep.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/RemoveEmptyOptionalsStep.java @@ -5,7 +5,9 @@ import com.orientechnologies.orient.core.sql.executor.resultset.OExecutionStream; import com.orientechnologies.orient.core.sql.parser.OIdentifier; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class RemoveEmptyOptionalsStep extends AbstractExecutionStep { public RemoveEmptyOptionalsStep( diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/SaveElementStep.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/SaveElementStep.java index 311a9481630..f882a949eec 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/SaveElementStep.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/SaveElementStep.java @@ -5,7 +5,9 @@ import com.orientechnologies.orient.core.sql.executor.resultset.OExecutionStream; import com.orientechnologies.orient.core.sql.parser.OIdentifier; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class SaveElementStep extends AbstractExecutionStep { private final OIdentifier cluster; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/UpsertStep.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/UpsertStep.java index 5d16443a0ff..2e23e910323 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/UpsertStep.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/UpsertStep.java @@ -14,7 +14,9 @@ import com.orientechnologies.orient.core.sql.parser.OWhereClause; import java.util.List; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class UpsertStep extends AbstractExecutionStep { private final OFromClause commandTarget; private final OWhereClause initialFilter; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/filter/OFilterOptimizer.java b/core/src/main/java/com/orientechnologies/orient/core/sql/filter/OFilterOptimizer.java index ac498f7f9dd..fb37ae649ff 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/filter/OFilterOptimizer.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/filter/OFilterOptimizer.java @@ -27,7 +27,9 @@ import com.orientechnologies.orient.core.sql.operator.OQueryOperatorEquals; import java.util.Map; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public class OFilterOptimizer { public void optimize(OSQLFilter filter, OIndexSearchResult indexMatch) { filter.setRootCondition(optimize(filter.getRootCondition(), indexMatch)); diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/filter/OSQLFilterItemAbstract.java b/core/src/main/java/com/orientechnologies/orient/core/sql/filter/OSQLFilterItemAbstract.java index d76213f7d7b..2b12ac18d16 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/filter/OSQLFilterItemAbstract.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/filter/OSQLFilterItemAbstract.java @@ -117,7 +117,8 @@ else if (pindex > -1) { // ERROR: METHOD/FUNCTION NOT FOUND OR MISPELLED throw new OQueryParsingException( iQueryToParse.parserText, - "Syntax error: function or field operator not recognized between the supported ones: " + "Syntax error: function or field operator not recognized between the supported" + + " ones: " + OSQLEngine.getMethodNames(), 0); diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OCustomSQLFunctionFactory.java b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OCustomSQLFunctionFactory.java index aff4556ffaa..7d9f7b4da19 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OCustomSQLFunctionFactory.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OCustomSQLFunctionFactory.java @@ -84,7 +84,8 @@ public OSQLFunction createFunction(final String name) { new OCommandExecutionException( "Error in creation of function " + name - + "(). Probably there is not an empty constructor or the constructor generates errors"), + + "(). Probably there is not an empty constructor or the constructor generates" + + " errors"), e); } } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionFactory.java b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionFactory.java index 0605898dbf1..fe5e579aadd 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionFactory.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionFactory.java @@ -18,12 +18,16 @@ import com.orientechnologies.orient.core.exception.OCommandExecutionException; import java.util.Set; -/** @author Johann Sorel (Geomatys) */ +/** + * @author Johann Sorel (Geomatys) + */ public interface OSQLFunctionFactory { boolean hasFunction(String iName); - /** @return Set of supported function names of this factory */ + /** + * @return Set of supported function names of this factory + */ Set getFunctionNames(); /** diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionFactoryTemplate.java b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionFactoryTemplate.java index 83109805885..43ad8aa81f0 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionFactoryTemplate.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionFactoryTemplate.java @@ -51,7 +51,8 @@ public OSQLFunction createFunction(final String name) throws OCommandExecutionEx new OCommandExecutionException( "Error in creation of function " + name - + "(). Probably there is not an empty constructor or the constructor generates errors"), + + "(). Probably there is not an empty constructor or the constructor generates" + + " errors"), e); } } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionFiltered.java b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionFiltered.java index ffd65b1a1fe..1072c37bf0d 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionFiltered.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionFiltered.java @@ -23,7 +23,9 @@ import com.orientechnologies.orient.core.command.OCommandContext; import com.orientechnologies.orient.core.db.record.OIdentifiable; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public interface OSQLFunctionFiltered extends OSQLFunction { /** diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/conversion/package-info.java b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/conversion/package-info.java index 9ab1a789bf1..c881ce0c44e 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/conversion/package-info.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/conversion/package-info.java @@ -13,5 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** @author Luca Garulli (l.garulli--(at)--orientdb.com) */ +/** + * @author Luca Garulli (l.garulli--(at)--orientdb.com) + */ package com.orientechnologies.orient.core.sql.functions.conversion; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/graph/OSQLFunctionAstar.java b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/graph/OSQLFunctionAstar.java index 16a0112e47a..b73ff1099a7 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/graph/OSQLFunctionAstar.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/graph/OSQLFunctionAstar.java @@ -288,9 +288,11 @@ private void bindAdditionalParams(Object additionalParams, OSQLFunctionAstar ctx } public String getSyntax() { - return "astar(, , , []) \n " - + "// options : {direction:\"OUT\",edgeTypeNames:[] , vertexAxisNames:[] , parallel : false , " - + "tieBreaker:true,maxDepth:99999,dFactor:1.0,customHeuristicFormula:'custom_Function_Name_here' }"; + return "astar(, , , []) \n" + + " // options : {direction:\"OUT\",edgeTypeNames:[] , vertexAxisNames:[] ," + + " parallel : false ," + + " tieBreaker:true,maxDepth:99999,dFactor:1.0,customHeuristicFormula:'custom_Function_Name_here'" + + " }"; } @Override diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/graph/OSQLFunctionShortestPath.java b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/graph/OSQLFunctionShortestPath.java index b554c6127e7..5acf7974381 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/graph/OSQLFunctionShortestPath.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/graph/OSQLFunctionShortestPath.java @@ -65,6 +65,7 @@ private class OShortestPathContext { private OVertex current; private OVertex currentRight; public Integer maxDepth; + /** option that decides whether or not to return the edge information */ public Boolean edge; } @@ -300,7 +301,8 @@ private ORawPair, Iterable> getVerticesAndEdges( } public String getSyntax() { - return "shortestPath(, , [, [ ]])"; + return "shortestPath(, , [, [ " + + " ]])"; } protected List walkLeft(final OSQLFunctionShortestPath.OShortestPathContext ctx) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/misc/OSQLFunctionCoalesce.java b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/misc/OSQLFunctionCoalesce.java index 356de7fd7cb..6b5a0a1ccf1 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/misc/OSQLFunctionCoalesce.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/misc/OSQLFunctionCoalesce.java @@ -84,6 +84,7 @@ public Object execute( @Override public String getSyntax() { - return "Returns the first not-null parameter or null if all parameters are null. Syntax: coalesce( [,]*)"; + return "Returns the first not-null parameter or null if all parameters are null. Syntax:" + + " coalesce( [,]*)"; } } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/misc/OSQLFunctionIfNull.java b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/misc/OSQLFunctionIfNull.java index 727c20ce0af..9664fed27d4 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/misc/OSQLFunctionIfNull.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/misc/OSQLFunctionIfNull.java @@ -89,6 +89,7 @@ public Object execute( @Override public String getSyntax() { - return "Syntax error: ifnull(, [,])"; + return "Syntax error: ifnull(, " + + " [,])"; } } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/misc/OSQLFunctionStrcmpci.java b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/misc/OSQLFunctionStrcmpci.java index a96e80742b7..9c52719dce9 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/misc/OSQLFunctionStrcmpci.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/misc/OSQLFunctionStrcmpci.java @@ -19,7 +19,9 @@ import com.orientechnologies.orient.core.db.record.OIdentifiable; import com.orientechnologies.orient.core.sql.functions.OSQLFunctionAbstract; -/** @author mdjurovi */ +/** + * @author mdjurovi + */ public class OSQLFunctionStrcmpci extends OSQLFunctionAbstract { public static final String NAME = "strcmpci"; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/text/package-info.java b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/text/package-info.java index 7c96dbb4168..d73d7cd0922 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/functions/text/package-info.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/functions/text/package-info.java @@ -13,5 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** @author Luca Garulli (l.garulli--(at)--orientdb.com) */ +/** + * @author Luca Garulli (l.garulli--(at)--orientdb.com) + */ package com.orientechnologies.orient.core.sql.functions.text; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/method/OSQLMethod.java b/core/src/main/java/com/orientechnologies/orient/core/sql/method/OSQLMethod.java index 67c860b3a7c..16cbf3adaef 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/method/OSQLMethod.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/method/OSQLMethod.java @@ -26,7 +26,9 @@ */ public interface OSQLMethod extends Comparable { - /** @return method name */ + /** + * @return method name + */ String getName(); /** @@ -44,10 +46,14 @@ public interface OSQLMethod extends Comparable { */ public String getSyntax(); - /** @return minimum number of arguments requiered by this method */ + /** + * @return minimum number of arguments requiered by this method + */ int getMinParams(); - /** @return maximum number of arguments requiered by this method */ + /** + * @return maximum number of arguments requiered by this method + */ int getMaxParams(); /** diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/method/OSQLMethodFactory.java b/core/src/main/java/com/orientechnologies/orient/core/sql/method/OSQLMethodFactory.java index 17716f5419b..3f409099fcf 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/method/OSQLMethodFactory.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/method/OSQLMethodFactory.java @@ -18,12 +18,16 @@ import com.orientechnologies.orient.core.exception.OCommandExecutionException; import java.util.Set; -/** @author Johann Sorel (Geomatys) */ +/** + * @author Johann Sorel (Geomatys) + */ public interface OSQLMethodFactory { boolean hasMethod(String iName); - /** @return Set of supported method names of this factory */ + /** + * @return Set of supported method names of this factory + */ Set getMethodNames(); /** diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/method/misc/OAbstractSQLMethod.java b/core/src/main/java/com/orientechnologies/orient/core/sql/method/misc/OAbstractSQLMethod.java index 0aa65d3fe11..db3866c7b95 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/method/misc/OAbstractSQLMethod.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/method/misc/OAbstractSQLMethod.java @@ -19,7 +19,9 @@ import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.method.OSQLMethod; -/** @author Johann Sorel (Geomatys) */ +/** + * @author Johann Sorel (Geomatys) + */ public abstract class OAbstractSQLMethod implements OSQLMethod { private final String name; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/method/misc/OSQLMethodLastIndexOf.java b/core/src/main/java/com/orientechnologies/orient/core/sql/method/misc/OSQLMethodLastIndexOf.java index c379e998af2..298a3f23ce1 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/method/misc/OSQLMethodLastIndexOf.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/method/misc/OSQLMethodLastIndexOf.java @@ -20,7 +20,9 @@ import com.orientechnologies.orient.core.command.OCommandContext; import com.orientechnologies.orient.core.db.record.OIdentifiable; -/** @author Luca Garulli (l.garulli--(at)--orientdb.com) */ +/** + * @author Luca Garulli (l.garulli--(at)--orientdb.com) + */ public class OSQLMethodLastIndexOf extends OAbstractSQLMethod { public static final String NAME = "lastindexof"; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/operator/OQueryOperatorFactory.java b/core/src/main/java/com/orientechnologies/orient/core/sql/operator/OQueryOperatorFactory.java index dd7f89e60b2..dbca45066ff 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/operator/OQueryOperatorFactory.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/operator/OQueryOperatorFactory.java @@ -24,6 +24,8 @@ */ public interface OQueryOperatorFactory { - /** @return set of operators */ + /** + * @return set of operators + */ Set getOperators(); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/operator/OQueryOperatorTraverse.java b/core/src/main/java/com/orientechnologies/orient/core/sql/operator/OQueryOperatorTraverse.java index 06fdf79ec70..9232778ed3f 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/operator/OQueryOperatorTraverse.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/operator/OQueryOperatorTraverse.java @@ -60,7 +60,8 @@ public OQueryOperatorTraverse( @Override public String getSyntax() { - return " TRAVERSE[( [, [,]] )] ( )"; + return " TRAVERSE[( [, [,]] )] (" + + " )"; } @Override diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/JavaCharStream.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/JavaCharStream.java index da5d3fe0f0e..29043a13ae7 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/JavaCharStream.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/JavaCharStream.java @@ -156,7 +156,9 @@ protected char ReadByte() throws java.io.IOException { return nextCharBuf[nextCharInd]; } - /** @return starting character for token. */ + /** + * @return starting character for token. + */ public char BeginToken() throws java.io.IOException { if (inBuf > 0) { --inBuf; @@ -319,12 +321,16 @@ public int getEndLine() { return bufline[bufpos]; } - /** @return column of token start */ + /** + * @return column of token start + */ public int getBeginColumn() { return bufcolumn[tokenBegin]; } - /** @return line number of token start */ + /** + * @return line number of token start + */ public int getBeginLine() { return bufline[tokenBegin]; } @@ -358,6 +364,7 @@ public JavaCharStream(java.io.Reader dstream, int startline, int startcolumn) { public JavaCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } + /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; @@ -385,6 +392,7 @@ public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); } + /** Constructor. */ public JavaCharStream( java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) @@ -444,15 +452,18 @@ public void ReInit( public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } + /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, startline, startcolumn, 4096); } + /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } + /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { @@ -464,7 +475,9 @@ public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } - /** @return token image as String */ + /** + * @return token image as String + */ public String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else @@ -472,7 +485,9 @@ public String GetImage() { + new String(buffer, 0, bufpos + 1); } - /** @return suffix */ + /** + * @return suffix + */ public char[] GetSuffix(int len) { char[] ret = new char[len]; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterClassStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterClassStatement.java index 510ad6c962a..fc4ddacfcd9 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterClassStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterClassStatement.java @@ -21,6 +21,7 @@ public class OAlterClassStatement extends ODDLStatement { /** the name of the class */ protected OIdentifier name; + /** the class property to be altered */ public OClass.ATTRIBUTES property; @@ -430,7 +431,8 @@ private void checkNotIndexed(OClass oClass) { throw new OCommandExecutionException( "Cannot rename class '" + oClass.getName() - + "' because it has indexes defined on it. Drop indexes before or use UNSAFE (at your won risk)"); + + "' because it has indexes defined on it. Drop indexes before or use UNSAFE (at your" + + " won risk)"); } } @@ -439,7 +441,8 @@ private void checkNotEdge(OClass oClass) { throw new OCommandExecutionException( "Cannot alter class '" + oClass - + "' because is an Edge class and could break vertices. Use UNSAFE if you want to force it"); + + "' because is an Edge class and could break vertices. Use UNSAFE if you want to" + + " force it"); } } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAndBlock.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAndBlock.java index 3ded2b944b0..efc6152f87d 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAndBlock.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAndBlock.java @@ -149,7 +149,8 @@ public List flatten() { for (OAndBlock subAndItem : subFlattened) { if (first) { result.add(subAndItem); - } else {; + } else { + ; for (OAndBlock oldResultItem : oldResult) { OAndBlock block = new OAndBlock(-1); block.subBlocks.addAll(oldResultItem.subBlocks); diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateIndexStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateIndexStatement.java index 86466294de1..96fba8061f0 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateIndexStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateIndexStatement.java @@ -129,7 +129,8 @@ Object execute(OCommandContext ctx) { String[] split = name.getValue().split("\\."); if (split.length != 2) { throw new ODatabaseException( - "Impossible to create an index without specify class and property name nor key types: " + "Impossible to create an index without specify class and property name nor key types:" + + " " + toString()); } OClass oClass = database.getClass(split[0]); @@ -146,7 +147,8 @@ Object execute(OCommandContext ctx) { } else { throw new ODatabaseException( - "Impossible to create an index without specify the key type or the associated property: " + "Impossible to create an index without specify the key type or the associated property:" + + " " + toString()); } } else { diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateViewStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateViewStatement.java index e1d2ac9175f..7ff3c9e0fed 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateViewStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateViewStatement.java @@ -114,12 +114,14 @@ public void checkMetadataSyntax() throws OCommandSQLParsingException { case "watchClasses": if (!(value instanceof Collection)) { throw new OCommandSQLParsingException( - "Invalid value for view metadata: watchClasses should be a list of class names as strings, it is " + "Invalid value for view metadata: watchClasses should be a list of class names as" + + " strings, it is " + value); } if (((Collection) value).stream().anyMatch(x -> !(x instanceof String))) { throw new OCommandSQLParsingException( - "Invalid value for view metadata: watchClasses should be a list of class names as strings, one value is null"); + "Invalid value for view metadata: watchClasses should be a list of class names as" + + " strings, one value is null"); } break; case "originRidField": @@ -132,24 +134,30 @@ public void checkMetadataSyntax() throws OCommandSQLParsingException { case "nodes": if (!(value instanceof Collection)) { throw new OCommandSQLParsingException( - "Invalid value for view metadata: nodes should be a list of class names as strings, it is " + "Invalid value for view metadata: nodes should be a list of class names as strings," + + " it is " + value); } if (((Collection) value).stream().anyMatch(x -> !(x instanceof String))) { throw new OCommandSQLParsingException( - "Invalid value for view metadata: nodes should be a list of class names as strings, one value is null"); + "Invalid value for view metadata: nodes should be a list of class names as strings," + + " one value is null"); } break; case "indexes": if (!(value instanceof Collection)) { throw new OCommandSQLParsingException( - "Invalid value for view metadata: indexes should be a list of class names as strings, it is " + "Invalid value for view metadata: indexes should be a list of class names as" + + " strings, it is " + value); } for (Object o : (Collection) value) { if (!(o instanceof Map)) { throw new OCommandSQLParsingException( - "Invalid value for view metadata: index configuration should be as follows: {type:'', engine:'', properties:{propName1:'', propNameN:'}}. Engine is optional"); + "Invalid value for view metadata: index configuration should be as follows:" + + " {type:'', engine:''," + + " properties:{propName1:'', propNameN:'}}. Engine is" + + " optional"); } Map valueMap = (Map) o; for (String idxKey : valueMap.keySet()) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropClassStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropClassStatement.java index 6851716e3d5..2f85cac01f7 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropClassStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropClassStatement.java @@ -49,13 +49,15 @@ public OExecutionStream executeDDL(OCommandContext ctx) { throw new OCommandExecutionException( "'DROP CLASS' command cannot drop class '" + className - + "' because it contains Vertices. Use 'DELETE VERTEX' command first to avoid broken edges in a database, or apply the 'UNSAFE' keyword to force it"); + + "' because it contains Vertices. Use 'DELETE VERTEX' command first to avoid" + + " broken edges in a database, or apply the 'UNSAFE' keyword to force it"); } else if (clazz.isEdgeType()) { // FOUND EDGE CLASS throw new OCommandExecutionException( "'DROP CLASS' command cannot drop class '" + className - + "' because it contains Edges. Use 'DELETE EDGE' command first to avoid broken vertices in a database, or apply the 'UNSAFE' keyword to force it"); + + "' because it contains Edges. Use 'DELETE EDGE' command first to avoid broken" + + " vertices in a database, or apply the 'UNSAFE' keyword to force it"); } } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropViewStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropViewStatement.java index 223e4d7c26a..486cda3610b 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropViewStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropViewStatement.java @@ -40,12 +40,14 @@ public OExecutionStream executeDDL(OCommandContext ctx) { throw new OCommandExecutionException( "'DROP VIEW' command cannot drop view '" + name.getStringValue() - + "' because it contains Vertices. Use 'DELETE VERTEX' command first to avoid broken edges in a database, or apply the 'UNSAFE' keyword to force it"); + + "' because it contains Vertices. Use 'DELETE VERTEX' command first to avoid" + + " broken edges in a database, or apply the 'UNSAFE' keyword to force it"); } else if (view.isEdgeType()) { throw new OCommandExecutionException( "'DROP VIEW' command cannot drop view '" + name.getStringValue() - + "' because it contains Edges. Use 'DELETE EDGE' command first to avoid broken vertices in a database, or apply the 'UNSAFE' keyword to force it"); + + "' because it contains Edges. Use 'DELETE EDGE' command first to avoid broken" + + " vertices in a database, or apply the 'UNSAFE' keyword to force it"); } } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OExecutionPlanCache.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OExecutionPlanCache.java index c7fe622083c..1bb884f04ed 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OExecutionPlanCache.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OExecutionPlanCache.java @@ -27,7 +27,9 @@ public class OExecutionPlanCache implements OMetadataUpdateListener { protected long lastInvalidation = -1; protected long lastGlobalTimeout = OGlobalConfiguration.COMMAND_TIMEOUT.getValueAsLong(); - /** @param size the size of the cache */ + /** + * @param size the size of the cache + */ public OExecutionPlanCache(int size) { this.mapSize = size; map = diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchPathItemFirst.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchPathItemFirst.java index f8bd59abf1c..f65f67fcfd7 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchPathItemFirst.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchPathItemFirst.java @@ -5,7 +5,9 @@ import java.util.Collections; import java.util.Map; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OMatchPathItemFirst extends OMatchPathItem { protected OFunctionCall function; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OStatementCache.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OStatementCache.java index 5e7a79aeab7..46b787df093 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OStatementCache.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OStatementCache.java @@ -23,7 +23,9 @@ public class OStatementCache { private Map map; private int mapSize; - /** @param size the size of the cache */ + /** + * @param size the size of the cache + */ public OStatementCache(int size) { this.mapSize = size; map = @@ -79,6 +81,7 @@ public static OServerStatement getServerStatement(String statement, OrientDBInte // TODO create a global cache! return parseServerStatement(statement); } + /** * @param statement an SQL statement * @return the corresponding executor, taking it from the internal cache, if it exists diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTruncateClassStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTruncateClassStatement.java index 6e6b62e3a0b..0d6adb0908b 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTruncateClassStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTruncateClassStatement.java @@ -42,10 +42,12 @@ public OExecutionStream executeDDL(OCommandContext ctx) { if (recs > 0 && !unsafe) { if (clazz.isSubClassOf("V")) { throw new OCommandExecutionException( - "'TRUNCATE CLASS' command cannot be used on not empty vertex classes. Apply the 'UNSAFE' keyword to force it (at your own risk)"); + "'TRUNCATE CLASS' command cannot be used on not empty vertex classes. Apply the" + + " 'UNSAFE' keyword to force it (at your own risk)"); } else if (clazz.isSubClassOf("E")) { throw new OCommandExecutionException( - "'TRUNCATE CLASS' command cannot be used on not empty edge classes. Apply the 'UNSAFE' keyword to force it (at your own risk)"); + "'TRUNCATE CLASS' command cannot be used on not empty edge classes. Apply the 'UNSAFE'" + + " keyword to force it (at your own risk)"); } } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSql.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSql.java index 1583f844a74..35a1e94bfd9 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSql.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSql.java @@ -300,7 +300,8 @@ public final List parseScript() throws ParseException { case KEY: case IDENTIFIER: case QUOTED_IDENTIFIER: - case 271:; + case 271: + ; break; default: jj_la1[2] = jj_gen; @@ -2224,7 +2225,8 @@ public final OTraverseStatement TraverseStatement() throws ParseException { label_2: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[47] = jj_gen; @@ -2341,7 +2343,8 @@ public final OMatchStatement MatchStatement() throws ParseException { label_3: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[54] = jj_gen; @@ -2409,7 +2412,8 @@ public final OMatchStatement MatchStatement() throws ParseException { label_4: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[59] = jj_gen; @@ -2772,7 +2776,8 @@ public final ODeleteEdgeStatement DeleteEdgeByRidStatement() throws ParseExcepti label_5: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[76] = jj_gen; @@ -3395,7 +3400,8 @@ public final OUpdateEdgeStatement UpdateEdgeStatement() throws ParseException { case MERGE: case CONTENT: case REMOVE: - case INCREMENT:; + case INCREMENT: + ; break; default: jj_la1[95] = jj_gen; @@ -3689,7 +3695,8 @@ public final OUpdateStatement UpdateStatement() throws ParseException { case MERGE: case CONTENT: case REMOVE: - case INCREMENT:; + case INCREMENT: + ; break; default: jj_la1[105] = jj_gen; @@ -3985,7 +3992,8 @@ public final OUpdateOperations UpdateOperations() throws ParseException { label_8: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[115] = jj_gen; @@ -4004,7 +4012,8 @@ public final OUpdateOperations UpdateOperations() throws ParseException { label_9: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[116] = jj_gen; @@ -4054,7 +4063,8 @@ public final OUpdateOperations UpdateOperations() throws ParseException { label_10: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[119] = jj_gen; @@ -4073,7 +4083,8 @@ public final OUpdateOperations UpdateOperations() throws ParseException { label_11: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[120] = jj_gen; @@ -4504,7 +4515,8 @@ public final OInsertStatement InsertStatement() throws ParseException { } if (jj_2_65(2147483647)) { jjtn000.insertBody = InsertBody(); - } else {; + } else { + ; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case RETURN: @@ -4636,7 +4648,8 @@ public final OInsertBody InsertBody() throws ParseException { label_12: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[135] = jj_gen; @@ -4656,7 +4669,8 @@ public final OInsertBody InsertBody() throws ParseException { label_13: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[136] = jj_gen; @@ -4670,7 +4684,8 @@ public final OInsertBody InsertBody() throws ParseException { label_14: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[137] = jj_gen; @@ -4685,7 +4700,8 @@ public final OInsertBody InsertBody() throws ParseException { label_15: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[138] = jj_gen; @@ -4707,7 +4723,8 @@ public final OInsertBody InsertBody() throws ParseException { label_16: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[139] = jj_gen; @@ -4742,7 +4759,8 @@ public final OInsertBody InsertBody() throws ParseException { label_17: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[141] = jj_gen; @@ -4870,7 +4888,8 @@ public final OCreateVertexStatement CreateVertexStatement() throws ParseExceptio } if (jj_2_73(2147483647)) { jjtn000.insertBody = InsertBody(); - } else {; + } else { + ; } jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; @@ -5533,7 +5552,8 @@ public final OProjection Projection() throws ParseException { label_18: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[158] = jj_gen; @@ -5553,7 +5573,8 @@ public final OProjection Projection() throws ParseException { label_19: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[159] = jj_gen; @@ -5696,7 +5717,8 @@ public final ONestedProjection NestedProjection() throws ParseException { label_20: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[164] = jj_gen; @@ -6086,7 +6108,8 @@ public final OArraySingleValuesSelector ArraySingleValuesSelector() throws Parse label_21: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[170] = jj_gen; @@ -6557,7 +6580,8 @@ public final OFunctionCall FunctionCall() throws ParseException { label_22: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[174] = jj_gen; @@ -6756,7 +6780,8 @@ public final OMethodCall MethodCall() throws ParseException { label_23: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[176] = jj_gen; @@ -7021,7 +7046,8 @@ public final OModifier Modifier() throws ParseException { } if (jj_2_91(2147483647)) { jjtn000.next = Modifier(); - } else {; + } else { + ; } jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; @@ -7160,7 +7186,8 @@ public final OArrayConcatExpression ArrayConcatExpression() throws ParseExceptio sub = ArrayConcatExpressionElement(); jjtn000.addChildExpression(sub); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case SC_OR:; + case SC_OR: + ; break; default: jj_la1[184] = jj_gen; @@ -7295,7 +7322,8 @@ public final OMathExpression MathExpression() throws ParseException { jjtn000.addChildExpression(sub); label_25: while (true) { - if (jj_2_97(2)) {; + if (jj_2_97(2)) { + ; } else { break label_25; } @@ -7767,7 +7795,8 @@ public final OBaseExpression BaseExpression() throws ParseException { jjtn000.setIdentifier(identifier); if (jj_2_101(2147483647)) { jjtn000.modifier = Modifier(); - } else {; + } else { + ; } break; case HOOK: @@ -7775,7 +7804,8 @@ public final OBaseExpression BaseExpression() throws ParseException { jjtn000.inputParam = InputParameter(); if (jj_2_102(2147483647)) { jjtn000.modifier = Modifier(); - } else {; + } else { + ; } break; case RID_STRING: @@ -7797,7 +7827,8 @@ public final OBaseExpression BaseExpression() throws ParseException { } if (jj_2_103(2147483647)) { jjtn000.modifier = Modifier(); - } else {; + } else { + ; } break; default: @@ -7897,7 +7928,8 @@ public final OLetClause LetClause() throws ParseException { label_26: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[191] = jj_gen; @@ -8030,7 +8062,8 @@ public final OFromItem FromItem() throws ParseException { label_27: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[193] = jj_gen; @@ -8063,7 +8096,8 @@ public final OFromItem FromItem() throws ParseException { while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case COMMA: - case COLON:; + case COLON: + ; break; default: jj_la1[195] = jj_gen; @@ -8109,7 +8143,8 @@ public final OFromItem FromItem() throws ParseException { jj_consume_token(RPAREN); if (jj_2_105(2147483647)) { jjtn000.modifier = Modifier(); - } else {; + } else { + ; } break; case HOOK: @@ -8122,7 +8157,8 @@ public final OFromItem FromItem() throws ParseException { jjtn000.functionCall = FunctionCall(); if (jj_2_106(2147483647)) { jjtn000.modifier = Modifier(); - } else {; + } else { + ; } } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { @@ -8242,7 +8278,8 @@ public final OFromItem FromItem() throws ParseException { jjtn000.setIdentifier(identifier); if (jj_2_107(2147483647)) { jjtn000.modifier = Modifier(); - } else {; + } else { + ; } break; default: @@ -8457,7 +8494,8 @@ public final OClusterList ClusterList() throws ParseException { label_29: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[202] = jj_gen; @@ -8558,7 +8596,8 @@ public final OIndexName IndexName() throws ParseException { while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case DOT: - case MINUS:; + case MINUS: + ; break; default: jj_la1[205] = jj_gen; @@ -8750,7 +8789,8 @@ public final OOrBlock OrBlock() throws ParseException { label_31: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case OR:; + case OR: + ; break; default: jj_la1[209] = jj_gen; @@ -8808,7 +8848,8 @@ public final OAndBlock AndBlock() throws ParseException { label_32: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case AND:; + case AND: + ; break; default: jj_la1[210] = jj_gen; @@ -11385,7 +11426,8 @@ public final OOrderBy OrderBy() throws ParseException { label_33: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[234] = jj_gen; @@ -11919,7 +11961,8 @@ public final OGroupBy GroupBy() throws ParseException { label_34: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[246] = jj_gen; @@ -11978,7 +12021,8 @@ public final OUnwind Unwind() throws ParseException { label_35: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[247] = jj_gen; @@ -12523,7 +12567,8 @@ public final OCollection Collection() throws ParseException { label_36: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[255] = jj_gen; @@ -12701,7 +12746,8 @@ public final OFetchPlan FetchPlan() throws ParseException { case IN: case KEY: case IDENTIFIER: - case QUOTED_IDENTIFIER:; + case QUOTED_IDENTIFIER: + ; break; default: jj_la1[257] = jj_gen; @@ -12914,7 +12960,8 @@ public final OFetchPlanItem FetchPlanItem() throws ParseException { label_38: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case DOT:; + case DOT: + ; break; default: jj_la1[261] = jj_gen; @@ -12991,7 +13038,8 @@ public final OTraverseProjectionItem TraverseProjectionItem() throws ParseExcept jjtn000.base = BaseIdentifier(); if (jj_2_145(2147483647)) { jjtn000.modifier = Modifier(); - } else {; + } else { + ; } jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; @@ -13296,7 +13344,8 @@ public final OJson Json() throws ParseException { label_39: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[265] = jj_gen; @@ -13498,7 +13547,8 @@ public final OMatchExpression MatchExpression() throws ParseException { case DOT: case LT: case DECR: - case MINUS:; + case MINUS: + ; break; default: jj_la1[268] = jj_gen; @@ -13739,7 +13789,8 @@ public final OMatchPathItem MultiMatchPathItem() throws ParseException { jjtn000.addItem(nextItem); label_41: while (true) { - if (jj_2_151(2147483647)) {; + if (jj_2_151(2147483647)) { + ; } else { break label_41; } @@ -13825,7 +13876,8 @@ public final OMatchPathItem MultiMatchPathItemArrows() throws ParseException { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LT: case DECR: - case MINUS:; + case MINUS: + ; break; default: jj_la1[275] = jj_gen; @@ -13904,7 +13956,8 @@ public final OMatchFilter MatchFilter() throws ParseException { label_43: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[277] = jj_gen; @@ -15612,7 +15665,8 @@ public final OTruncateRecordStatement TruncateRecordStatement() throws ParseExce label_44: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[303] = jj_gen; @@ -15828,7 +15882,8 @@ public final OFindReferencesStatement FindReferencesStatement() throws ParseExce label_45: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[308] = jj_gen; @@ -16034,7 +16089,8 @@ public final OCreateClassStatement CreateClassStatement() throws ParseException label_46: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[312] = jj_gen; @@ -16058,7 +16114,8 @@ public final OCreateClassStatement CreateClassStatement() throws ParseException label_47: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[314] = jj_gen; @@ -16618,7 +16675,8 @@ public final OAlterClassStatement AlterClassStatement() throws ParseException { label_48: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[324] = jj_gen; @@ -17792,7 +17850,8 @@ public final OCreatePropertyStatement CreatePropertyStatement() throws ParseExce if (jj_2_155(3)) { IfNotExists(); jjtn000.ifNotExists = true; - } else {; + } else { + ; } jjtn000.propertyType = Identifier(); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { @@ -17922,7 +17981,8 @@ public final OCreatePropertyStatement CreatePropertyStatement() throws ParseExce label_49: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[341] = jj_gen; @@ -17994,7 +18054,8 @@ public final OCreatePropertyAttributeStatement CreatePropertyAttributeStatement( jjtn000.settingName = Identifier(); if (getToken(1).kind != COMMA && getToken(1).kind != RPAREN) { jjtn000.settingValue = Expression(); - } else {; + } else { + ; } jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; @@ -18463,7 +18524,8 @@ public final OCreateIndexStatement CreateIndexStatement() throws ParseException label_50: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[352] = jj_gen; @@ -19120,7 +19182,8 @@ public final OCreateIndexStatement CreateIndexStatement() throws ParseException label_51: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[359] = jj_gen; @@ -19387,7 +19450,8 @@ public final OCreateIndexStatement CreateIndexStatement() throws ParseException label_52: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[363] = jj_gen; @@ -20344,7 +20408,8 @@ public final OOptimizeDatabaseStatement OptimizeDatabaseStatement() throws Parse label_53: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case MINUS:; + case MINUS: + ; break; default: jj_la1[377] = jj_gen; @@ -20996,7 +21061,8 @@ public final OCreateFunctionStatement CreateFunctionStatement() throws ParseExce label_54: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[384] = jj_gen; @@ -21461,7 +21527,8 @@ public final OCreateSystemUserStatement CreateSystemUserStatement() throws Parse label_55: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[390] = jj_gen; @@ -22074,7 +22141,8 @@ public final OCreateUserStatement CreateUserStatement() throws ParseException { label_56: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[396] = jj_gen; @@ -22227,7 +22295,8 @@ public final OAlterRoleStatement AlterRoleStatement() throws ParseException { } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case SET: - case REMOVE:; + case REMOVE: + ; break; default: jj_la1[401] = jj_gen; @@ -22317,7 +22386,8 @@ public final OAlterSystemRoleStatement AlterSystemRoleStatement() throws ParseEx } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case SET: - case REMOVE:; + case REMOVE: + ; break; default: jj_la1[403] = jj_gen; @@ -22516,7 +22586,8 @@ public final OCommitStatement CommitStatement() throws ParseException { case SLEEP: case CONSOLE: case HA: - case MOVE:; + case MOVE: + ; break; default: jj_la1[405] = jj_gen; @@ -22976,7 +23047,8 @@ public final OIfStatement IfStatement() throws ParseException { case KEY: case IDENTIFIER: case QUOTED_IDENTIFIER: - case 271:; + case 271: + ; break; default: jj_la1[413] = jj_gen; @@ -23177,7 +23249,8 @@ public final OCreateSequenceStatement CreateSequenceStatement() throws ParseExce case DESC: case CACHE: case CYCLE: - case START:; + case START: + ; break; default: jj_la1[416] = jj_gen; @@ -23287,7 +23360,8 @@ public final OAlterSequenceStatement AlterSequenceStatement() throws ParseExcept case CACHE: case CYCLE: case NOLIMIT: - case START:; + case START: + ; break; default: jj_la1[419] = jj_gen; @@ -23455,7 +23529,8 @@ public final OHaStatusStatement HaStatusStatement() throws ParseException { case 277: case 278: case 279: - case 280:; + case 280: + ; break; default: jj_la1[423] = jj_gen; @@ -23575,7 +23650,8 @@ public final OHaSyncDatabaseStatement HaSyncDatabaseStatement() throws ParseExce while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 281: - case 282:; + case 282: + ; break; default: jj_la1[425] = jj_gen; @@ -23888,7 +23964,8 @@ public final OForEachBlock ForEachBlock() throws ParseException { case KEY: case IDENTIFIER: case QUOTED_IDENTIFIER: - case 271:; + case 271: + ; break; default: jj_la1[429] = jj_gen; @@ -24115,7 +24192,8 @@ public final OWhileBlock WhileBlock() throws ParseException { case KEY: case IDENTIFIER: case QUOTED_IDENTIFIER: - case 271:; + case 271: + ; break; default: jj_la1[431] = jj_gen; @@ -24486,7 +24564,8 @@ public final OCreateSecurityPolicyStatement CreateSecurityPolicyStatement() label_67: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[436] = jj_gen; @@ -24654,7 +24733,8 @@ public final OAlterSecurityPolicyStatement AlterSecurityPolicyStatement() throws label_69: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[440] = jj_gen; @@ -24750,7 +24830,8 @@ public final OAlterSecurityPolicyStatement AlterSecurityPolicyStatement() throws label_70: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[443] = jj_gen; @@ -24798,7 +24879,8 @@ public final OAlterSecurityPolicyStatement AlterSecurityPolicyStatement() throws } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case SET: - case REMOVE:; + case REMOVE: + ; break; default: jj_la1[446] = jj_gen; @@ -25341,7 +25423,8 @@ public final ODatabaseUserData DatabaseUserData() throws ParseException { label_71: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[449] = jj_gen; @@ -25558,7 +25641,8 @@ public final OCreateDatabaseStatement CreateDatabaseStatement() throws ParseExce label_72: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA:; + case COMMA: + ; break; default: jj_la1[455] = jj_gen; @@ -37619,8 +37703,10 @@ private boolean jj_3R_442() { /** Generated Token Manager. */ public OrientSqlTokenManager token_source; + /** Current token. */ public Token token; + /** Next token. */ public Token jj_nt; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSqlConstants.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSqlConstants.java index 1b9572a1fd8..745b2667080 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSqlConstants.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSqlConstants.java @@ -6,535 +6,799 @@ public interface OrientSqlConstants { /** End of File. */ int EOF = 0; + /** RegularExpression Id. */ int FORMAL_COMMENT = 8; + /** RegularExpression Id. */ int MULTI_LINE_COMMENT = 9; + /** RegularExpression Id. */ int SELECT = 11; + /** RegularExpression Id. */ int TRAVERSE = 12; + /** RegularExpression Id. */ int MATCH = 13; + /** RegularExpression Id. */ int INSERT = 14; + /** RegularExpression Id. */ int CREATE = 15; + /** RegularExpression Id. */ int DELETE = 16; + /** RegularExpression Id. */ int VERTEX = 17; + /** RegularExpression Id. */ int EDGE = 18; + /** RegularExpression Id. */ int UPDATE = 19; + /** RegularExpression Id. */ int UPSERT = 20; + /** RegularExpression Id. */ int FROM = 21; + /** RegularExpression Id. */ int TO = 22; + /** RegularExpression Id. */ int WHERE = 23; + /** RegularExpression Id. */ int WHILE = 24; + /** RegularExpression Id. */ int INTO = 25; + /** RegularExpression Id. */ int VALUE = 26; + /** RegularExpression Id. */ int VALUES = 27; + /** RegularExpression Id. */ int SET = 28; + /** RegularExpression Id. */ int ADD = 29; + /** RegularExpression Id. */ int PUT = 30; + /** RegularExpression Id. */ int MERGE = 31; + /** RegularExpression Id. */ int CONTENT = 32; + /** RegularExpression Id. */ int REMOVE = 33; + /** RegularExpression Id. */ int INCREMENT = 34; + /** RegularExpression Id. */ int AND = 35; + /** RegularExpression Id. */ int OR = 36; + /** RegularExpression Id. */ int NULL = 37; + /** RegularExpression Id. */ int DEFINED = 38; + /** RegularExpression Id. */ int ORDER = 39; + /** RegularExpression Id. */ int GROUP = 40; + /** RegularExpression Id. */ int BY = 41; + /** RegularExpression Id. */ int LIMIT = 42; + /** RegularExpression Id. */ int SKIP2 = 43; + /** RegularExpression Id. */ int BATCH = 44; + /** RegularExpression Id. */ int OFFSET = 45; + /** RegularExpression Id. */ int TIMEOUT = 46; + /** RegularExpression Id. */ int ASC = 47; + /** RegularExpression Id. */ int AS = 48; + /** RegularExpression Id. */ int DESC = 49; + /** RegularExpression Id. */ int FETCHPLAN = 50; + /** RegularExpression Id. */ int RETURN = 51; + /** RegularExpression Id. */ int BEFORE = 52; + /** RegularExpression Id. */ int AFTER = 53; + /** RegularExpression Id. */ int LOCK = 54; + /** RegularExpression Id. */ int RECORD = 55; + /** RegularExpression Id. */ int WAIT = 56; + /** RegularExpression Id. */ int RETRY = 57; + /** RegularExpression Id. */ int LET = 58; + /** RegularExpression Id. */ int CACHE = 59; + /** RegularExpression Id. */ int CYCLE = 60; + /** RegularExpression Id. */ int NOCACHE = 61; + /** RegularExpression Id. */ int NOLIMIT = 62; + /** RegularExpression Id. */ int NOCYCLE = 63; + /** RegularExpression Id. */ int UNSAFE = 64; + /** RegularExpression Id. */ int PARALLEL = 65; + /** RegularExpression Id. */ int STRATEGY = 66; + /** RegularExpression Id. */ int DEPTH_FIRST = 67; + /** RegularExpression Id. */ int BREADTH_FIRST = 68; + /** RegularExpression Id. */ int LUCENE = 69; + /** RegularExpression Id. */ int NEAR = 70; + /** RegularExpression Id. */ int WITHIN = 71; + /** RegularExpression Id. */ int UNWIND = 72; + /** RegularExpression Id. */ int MAXDEPTH = 73; + /** RegularExpression Id. */ int MINDEPTH = 74; + /** RegularExpression Id. */ int CLASS = 75; + /** RegularExpression Id. */ int SUPERCLASS = 76; + /** RegularExpression Id. */ int CLASSES = 77; + /** RegularExpression Id. */ int SUPERCLASSES = 78; + /** RegularExpression Id. */ int VIEW = 79; + /** RegularExpression Id. */ int UPDATABLE = 80; + /** RegularExpression Id. */ int EXCEPTION = 81; + /** RegularExpression Id. */ int PROFILE = 82; + /** RegularExpression Id. */ int STORAGE = 83; + /** RegularExpression Id. */ int ON = 84; + /** RegularExpression Id. */ int OFF = 85; + /** RegularExpression Id. */ int TRUNCATE = 86; + /** RegularExpression Id. */ int POLYMORPHIC = 87; + /** RegularExpression Id. */ int FIND = 88; + /** RegularExpression Id. */ int REFERENCES = 89; + /** RegularExpression Id. */ int EXTENDS = 90; + /** RegularExpression Id. */ int CLUSTERS = 91; + /** RegularExpression Id. */ int ABSTRACT = 92; + /** RegularExpression Id. */ int ALTER = 93; + /** RegularExpression Id. */ int NAME = 94; + /** RegularExpression Id. */ int SHORTNAME = 95; + /** RegularExpression Id. */ int OVERSIZE = 96; + /** RegularExpression Id. */ int STRICTMODE = 97; + /** RegularExpression Id. */ int ADDCLUSTER = 98; + /** RegularExpression Id. */ int REMOVECLUSTER = 99; + /** RegularExpression Id. */ int CUSTOM = 100; + /** RegularExpression Id. */ int CLUSTERSELECTION = 101; + /** RegularExpression Id. */ int DESCRIPTION = 102; + /** RegularExpression Id. */ int ENCRYPTION = 103; + /** RegularExpression Id. */ int DROP = 104; + /** RegularExpression Id. */ int PROPERTY = 105; + /** RegularExpression Id. */ int FORCE = 106; + /** RegularExpression Id. */ int METADATA = 107; + /** RegularExpression Id. */ int INDEX = 108; + /** RegularExpression Id. */ int COLLATE = 109; + /** RegularExpression Id. */ int ENGINE = 110; + /** RegularExpression Id. */ int REBUILD = 111; + /** RegularExpression Id. */ int ID = 112; + /** RegularExpression Id. */ int DATABASE = 113; + /** RegularExpression Id. */ int OPTIMIZE = 114; + /** RegularExpression Id. */ int LINK = 115; + /** RegularExpression Id. */ int TYPE = 116; + /** RegularExpression Id. */ int INVERSE = 117; + /** RegularExpression Id. */ int EXPLAIN = 118; + /** RegularExpression Id. */ int GRANT = 119; + /** RegularExpression Id. */ int REVOKE = 120; + /** RegularExpression Id. */ int READ = 121; + /** RegularExpression Id. */ int EXECUTE = 122; + /** RegularExpression Id. */ int ALL = 123; + /** RegularExpression Id. */ int NONE = 124; + /** RegularExpression Id. */ int FUNCTION = 125; + /** RegularExpression Id. */ int PARAMETERS = 126; + /** RegularExpression Id. */ int IDEMPOTENT = 127; + /** RegularExpression Id. */ int LANGUAGE = 128; + /** RegularExpression Id. */ int BEGIN = 129; + /** RegularExpression Id. */ int COMMIT = 130; + /** RegularExpression Id. */ int ROLLBACK = 131; + /** RegularExpression Id. */ int IF = 132; + /** RegularExpression Id. */ int ELSE = 133; + /** RegularExpression Id. */ int CONTINUE = 134; + /** RegularExpression Id. */ int FAIL = 135; + /** RegularExpression Id. */ int ISOLATION = 136; + /** RegularExpression Id. */ int SLEEP = 137; + /** RegularExpression Id. */ int CONSOLE = 138; + /** RegularExpression Id. */ int BLOB = 139; + /** RegularExpression Id. */ int SHARED = 140; + /** RegularExpression Id. */ int DEFAULT_ = 141; + /** RegularExpression Id. */ int SEQUENCE = 142; + /** RegularExpression Id. */ int START = 143; + /** RegularExpression Id. */ int OPTIONAL = 144; + /** RegularExpression Id. */ int COUNT = 145; + /** RegularExpression Id. */ int DISTINCT = 146; + /** RegularExpression Id. */ int HA = 147; + /** RegularExpression Id. */ int STATUS = 148; + /** RegularExpression Id. */ int SERVER = 149; + /** RegularExpression Id. */ int SYNC = 150; + /** RegularExpression Id. */ int EXISTS = 151; + /** RegularExpression Id. */ int FOREACH = 152; + /** RegularExpression Id. */ int MOVE = 153; + /** RegularExpression Id. */ int DEPTH_ALIAS = 154; + /** RegularExpression Id. */ int PATH_ALIAS = 155; + /** RegularExpression Id. */ int IDENTIFIED = 156; + /** RegularExpression Id. */ int ROLE = 157; + /** RegularExpression Id. */ int USER = 158; + /** RegularExpression Id. */ int USERS = 159; + /** RegularExpression Id. */ int RID = 160; + /** RegularExpression Id. */ int SECURITY = 161; + /** RegularExpression Id. */ int POLICY = 162; + /** RegularExpression Id. */ int DEFAULTCLUSTER = 163; + /** RegularExpression Id. */ int SYSTEM = 164; + /** RegularExpression Id. */ int THIS = 165; + /** RegularExpression Id. */ int RECORD_ATTRIBUTE = 166; + /** RegularExpression Id. */ int RID_ATTR = 167; + /** RegularExpression Id. */ int RID_STRING = 168; + /** RegularExpression Id. */ int CLASS_ATTR = 169; + /** RegularExpression Id. */ int VERSION_ATTR = 170; + /** RegularExpression Id. */ int SIZE_ATTR = 171; + /** RegularExpression Id. */ int TYPE_ATTR = 172; + /** RegularExpression Id. */ int RAW_ATTR = 173; + /** RegularExpression Id. */ int RID_ID_ATTR = 174; + /** RegularExpression Id. */ int RID_POS_ATTR = 175; + /** RegularExpression Id. */ int FIELDS_ATTR = 176; + /** RegularExpression Id. */ int INTEGER_LITERAL = 177; + /** RegularExpression Id. */ int DECIMAL_LITERAL = 178; + /** RegularExpression Id. */ int HEX_LITERAL = 179; + /** RegularExpression Id. */ int OCTAL_LITERAL = 180; + /** RegularExpression Id. */ int FLOATING_POINT_LITERAL = 181; + /** RegularExpression Id. */ int DECIMAL_FLOATING_POINT_LITERAL = 182; + /** RegularExpression Id. */ int DECIMAL_EXPONENT = 183; + /** RegularExpression Id. */ int HEXADECIMAL_FLOATING_POINT_LITERAL = 184; + /** RegularExpression Id. */ int HEXADECIMAL_EXPONENT = 185; + /** RegularExpression Id. */ int CHARACTER_LITERAL = 186; + /** RegularExpression Id. */ int STRING_LITERAL = 187; + /** RegularExpression Id. */ int INTEGER_RANGE = 188; + /** RegularExpression Id. */ int ELLIPSIS_INTEGER_RANGE = 189; + /** RegularExpression Id. */ int TRUE = 190; + /** RegularExpression Id. */ int FALSE = 191; + /** RegularExpression Id. */ int LPAREN = 192; + /** RegularExpression Id. */ int RPAREN = 193; + /** RegularExpression Id. */ int LBRACE = 194; + /** RegularExpression Id. */ int RBRACE = 195; + /** RegularExpression Id. */ int LBRACKET = 196; + /** RegularExpression Id. */ int RBRACKET = 197; + /** RegularExpression Id. */ int SEMICOLON = 198; + /** RegularExpression Id. */ int COMMA = 199; + /** RegularExpression Id. */ int DOT = 200; + /** RegularExpression Id. */ int AT = 201; + /** RegularExpression Id. */ int DOLLAR = 202; + /** RegularExpression Id. */ int BACKTICK = 203; + /** RegularExpression Id. */ int EQ = 204; + /** RegularExpression Id. */ int EQEQ = 205; + /** RegularExpression Id. */ int LT = 206; + /** RegularExpression Id. */ int GT = 207; + /** RegularExpression Id. */ int BANG = 208; + /** RegularExpression Id. */ int TILDE = 209; + /** RegularExpression Id. */ int HOOK = 210; + /** RegularExpression Id. */ int COLON = 211; + /** RegularExpression Id. */ int LE = 212; + /** RegularExpression Id. */ int GE = 213; + /** RegularExpression Id. */ int NE = 214; + /** RegularExpression Id. */ int NEQ = 215; + /** RegularExpression Id. */ int SC_OR = 216; + /** RegularExpression Id. */ int SC_AND = 217; + /** RegularExpression Id. */ int INCR = 218; + /** RegularExpression Id. */ int DECR = 219; + /** RegularExpression Id. */ int PLUS = 220; + /** RegularExpression Id. */ int MINUS = 221; + /** RegularExpression Id. */ int STAR = 222; + /** RegularExpression Id. */ int SLASH = 223; + /** RegularExpression Id. */ int BIT_AND = 224; + /** RegularExpression Id. */ int NULL_COALESCING = 225; + /** RegularExpression Id. */ int BIT_OR = 226; + /** RegularExpression Id. */ int XOR = 227; + /** RegularExpression Id. */ int REM = 228; + /** RegularExpression Id. */ int LSHIFT = 229; + /** RegularExpression Id. */ int PLUSASSIGN = 230; + /** RegularExpression Id. */ int MINUSASSIGN = 231; + /** RegularExpression Id. */ int STARASSIGN = 232; + /** RegularExpression Id. */ int SLASHASSIGN = 233; + /** RegularExpression Id. */ int ANDASSIGN = 234; + /** RegularExpression Id. */ int ORASSIGN = 235; + /** RegularExpression Id. */ int XORASSIGN = 236; + /** RegularExpression Id. */ int REMASSIGN = 237; + /** RegularExpression Id. */ int LSHIFTASSIGN = 238; + /** RegularExpression Id. */ int RSIGNEDSHIFTASSIGN = 239; + /** RegularExpression Id. */ int RUNSIGNEDSHIFTASSIGN = 240; + /** RegularExpression Id. */ int RSHIFT = 241; + /** RegularExpression Id. */ int RUNSIGNEDSHIFT = 242; + /** RegularExpression Id. */ int ELLIPSIS = 243; + /** RegularExpression Id. */ int RANGE = 244; + /** RegularExpression Id. */ int NOT = 245; + /** RegularExpression Id. */ int IN = 246; + /** RegularExpression Id. */ int LIKE = 247; + /** RegularExpression Id. */ int IS = 248; + /** RegularExpression Id. */ int BETWEEN = 249; + /** RegularExpression Id. */ int CONTAINS = 250; + /** RegularExpression Id. */ int CONTAINSALL = 251; + /** RegularExpression Id. */ int CONTAINSANY = 252; + /** RegularExpression Id. */ int CONTAINSKEY = 253; + /** RegularExpression Id. */ int CONTAINSVALUE = 254; + /** RegularExpression Id. */ int CONTAINSTEXT = 255; + /** RegularExpression Id. */ int MATCHES = 256; + /** RegularExpression Id. */ int KEY = 257; + /** RegularExpression Id. */ int INSTANCEOF = 258; + /** RegularExpression Id. */ int CLUSTER = 259; + /** RegularExpression Id. */ int IDENTIFIER = 260; + /** RegularExpression Id. */ int QUOTED_IDENTIFIER = 261; + /** RegularExpression Id. */ int INDEX_COLON = 262; + /** RegularExpression Id. */ int INDEXVALUES_IDENTIFIER = 263; + /** RegularExpression Id. */ int INDEXVALUESASC_IDENTIFIER = 264; + /** RegularExpression Id. */ int INDEXVALUESDESC_IDENTIFIER = 265; + /** RegularExpression Id. */ int CLUSTER_IDENTIFIER = 266; + /** RegularExpression Id. */ int CLUSTER_NUMBER_IDENTIFIER = 267; + /** RegularExpression Id. */ int METADATA_IDENTIFIER = 268; + /** RegularExpression Id. */ int LETTER = 269; + /** RegularExpression Id. */ int PART_LETTER = 270; /** Lexical state. */ int DEFAULT = 0; + /** Lexical state. */ int IN_FORMAL_COMMENT = 1; + /** Lexical state. */ int IN_MULTI_LINE_COMMENT = 2; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSqlTokenManager.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSqlTokenManager.java index 8e8e7966b38..32c5616d8bd 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSqlTokenManager.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSqlTokenManager.java @@ -6,6 +6,7 @@ public class OrientSqlTokenManager implements OrientSqlConstants { /** Debug output. */ public java.io.PrintStream debugStream = System.out; + /** Set debug output. */ public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; @@ -5321,6 +5322,7 @@ private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, lo private int jjimageLen; private int lengthOfMatch; protected char curChar; + /** Constructor. */ public OrientSqlTokenManager(CharStream stream) { input_stream = stream; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/Pattern.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/Pattern.java index 66af2852112..5bd78f79938 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/Pattern.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/Pattern.java @@ -55,11 +55,13 @@ public void validate() { if (node.isOptionalNode()) { if (node.out.size() > 0) { throw new OCommandSQLParsingException( - "In current MATCH version, optional nodes are allowed only on right terminal nodes, eg. {} --> {optional:true} is allowed, {optional:true} <-- {} is not. "); + "In current MATCH version, optional nodes are allowed only on right terminal nodes," + + " eg. {} --> {optional:true} is allowed, {optional:true} <-- {} is not. "); } if (node.in.size() == 0) { throw new OCommandSQLParsingException( - "In current MATCH version, optional nodes must have at least one incoming pattern edge"); + "In current MATCH version, optional nodes must have at least one incoming pattern" + + " edge"); } // if (node.in.size() != 1) { // throw new OCommandSQLParsingException("In current MATCH version, optional nodes diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/Token.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/Token.java index 6a61c0b5a5e..401c13a073b 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/Token.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/Token.java @@ -19,10 +19,13 @@ public class Token implements java.io.Serializable { /** The line number of the first character of this Token. */ public int beginLine; + /** The column number of the first character of this Token. */ public int beginColumn; + /** The line number of the last character of this Token. */ public int endLine; + /** The column number of the last character of this Token. */ public int endColumn; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/query/OSQLSynchQuery.java b/core/src/main/java/com/orientechnologies/orient/core/sql/query/OSQLSynchQuery.java index b22c23b2446..282a4b02acf 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/query/OSQLSynchQuery.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/query/OSQLSynchQuery.java @@ -111,7 +111,9 @@ public Object getResult() { return result; } - /** @return RID of the record that will be processed first during pagination mode. */ + /** + * @return RID of the record that will be processed first during pagination mode. + */ public ORID getNextPageRID() { return nextPageRID; } diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/OStorage.java b/core/src/main/java/com/orientechnologies/orient/core/storage/OStorage.java index 48853281a89..87cec3507a0 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/OStorage.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/OStorage.java @@ -88,7 +88,7 @@ void open( void close(); - void close(boolean iForce, boolean onDelete); + void close(boolean iForce); boolean isClosed(); @@ -192,7 +192,9 @@ boolean cleanOutRecord( long getVersion(); - /** @return Version of product release under which storage was created. */ + /** + * @return Version of product release under which storage was created. + */ String getCreatedAtVersion(); void synch(); @@ -239,7 +241,9 @@ boolean cleanOutRecord( void setConflictStrategy(ORecordConflictStrategy iResolver); - /** @return Backup file name */ + /** + * @return Backup file name + */ String incrementalBackup(String backupDirectory, OCallable started) throws UnsupportedOperationException; diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/cache/OCachePointer.java b/core/src/main/java/com/orientechnologies/orient/core/storage/cache/OCachePointer.java index 85bc843efaa..df89fb16d30 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/cache/OCachePointer.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/cache/OCachePointer.java @@ -23,7 +23,6 @@ import com.orientechnologies.common.directmemory.OPointer; import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OLogSequenceNumber; import java.nio.ByteBuffer; -import java.nio.ByteOrder; import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; import java.util.concurrent.atomic.AtomicLongFieldUpdater; import java.util.concurrent.locks.ReentrantReadWriteLock; @@ -44,7 +43,7 @@ public final class OCachePointer { } private static final int WRITERS_OFFSET = 32; - private static final int READERS_MASK = 0xFFFFFFFF; + private static final long READERS_MASK = 0xFFFFFFFFL; private final ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock(); @@ -232,16 +231,6 @@ public OPointer getPointer() { return pointer; } - public ByteBuffer getBufferDuplicate() { - if (pointer == null) { - return null; - } - final ByteBuffer duplicate = - pointer.getNativeByteBuffer().duplicate().order(ByteOrder.nativeOrder()); - duplicate.rewind(); - return duplicate; - } - public void acquireExclusiveLock() { readWriteLock.writeLock().lock(); version++; diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/FindMinDirtySegment.java b/core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/FindMinDirtySegment.java index 2d385a7ece4..a22c401d02e 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/FindMinDirtySegment.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/FindMinDirtySegment.java @@ -6,7 +6,9 @@ final class FindMinDirtySegment implements Callable { /** */ private final OWOWCache cache; - /** @param owowCache */ + /** + * @param owowCache + */ FindMinDirtySegment(OWOWCache owowCache) { cache = owowCache; } diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/OWOWCache.java b/core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/OWOWCache.java index 3120931d1ef..7295d9944d0 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/OWOWCache.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/OWOWCache.java @@ -117,7 +117,7 @@ *
  • It provides much less synchronization overhead * * - * Background thread is running by with predefined intervals. Such approach allows SSD GC to use + *

    Background thread is running by with predefined intervals. Such approach allows SSD GC to use * pauses to make some clean up of half empty erase blocks. Also write cache is used for checking of * free space left on disk and putting of database in "read mode" if space limit is reached and to * perform fuzzy checkpoints. Write cache holds two different type of pages, pages which are shared @@ -268,7 +268,7 @@ public final class OWOWCache extends OAbstractWriteCache *

  • If page with given index is absent into table we add it to this container * * - * Because we add last WAL LSN if we are going to modify page, it means that we can calculate + *

    Because we add last WAL LSN if we are going to modify page, it means that we can calculate * smallest LSN of operation which is not flushed to the log yet without locking of all operations * on database. There is may be situation when thread locks the page but did not add LSN to the * dirty pages table yet. If at the moment of start of iteration over the dirty pages table we @@ -392,7 +392,7 @@ public final class OWOWCache extends OAbstractWriteCache private final DoubleWriteLog doubleWriteLog; private boolean closed; - private ExecutorService executor; + private final ExecutorService executor; public OWOWCache( final int pageSize, @@ -540,13 +540,17 @@ public Path getRootDirectory() { return storagePath; } - /** @inheritDoc */ + /** + * @inheritDoc + */ @Override public void addPageIsBrokenListener(final OPageIsBrokenListener listener) { pageIsBrokenListeners.add(new WeakReference<>(listener)); } - /** @inheritDoc */ + /** + * @inheritDoc + */ @Override public void removePageIsBrokenListener(final OPageIsBrokenListener listener) { final List> itemsToRemove = new ArrayList<>(1); @@ -608,7 +612,9 @@ public long bookFileId(final String fileName) { } } - /** @inheritDoc */ + /** + * @inheritDoc + */ @Override public int pageSize() { return pageSize; @@ -661,7 +667,8 @@ public long loadFile(final String fileName) throws IOException { this, "File '" + fileName - + "' is not registered in 'file name - id' map, but exists in file system. Registering it"); + + "' is not registered in 'file name - id' map, but exists in file system." + + " Registering it"); openFile(fileClassic); @@ -2296,6 +2303,7 @@ private void writeNameIdEntry( serializedRecord.position(0); OIOUtils.writeByteBuffer(serializedRecord, nameIdMapHolder, nameIdMapHolder.size()); + //noinspection ResultOfMethodCallIgnored nameIdMapHolder.write(serializedRecord); if (sync) { @@ -2760,15 +2768,15 @@ private void flushWriteCacheFromMinLSN( assert copy.position() == 0; try { version = pointer.getVersion(); - final ByteBuffer buffer = pointer.getBufferDuplicate(); + final ByteBuffer buffer = pointer.getBuffer(); fullLogLSN = pointer.getEndLSN(); assert buffer != null; - buffer.position(0); - copy.position(0); + assert buffer.position() == 0; + assert copy.position() == 0; - copy.put(buffer); + copy.put(0, buffer, 0, buffer.capacity()); removeFromDirtyPages(pageKey); @@ -2787,11 +2795,9 @@ private void flushWriteCacheFromMinLSN( chunk.add(new OQuarto<>(version, copy, directPointer, pointer)); if (chunksSize + chunk.size() >= pagesFlushLimit) { - if (!chunk.isEmpty()) { - chunks.add(chunk); - chunksSize += chunk.size(); - chunk = new ArrayList<>(); - } + chunks.add(chunk); + chunksSize += chunk.size(); + chunk = new ArrayList<>(); lastPageIndex = -1; lastFileId = -1; @@ -3059,15 +3065,15 @@ private void flushExclusiveWriteCache(final CountDownLatch latch, long pagesToFl assert copy.position() == 0; try { version = pointer.getVersion(); - final ByteBuffer buffer = pointer.getBufferDuplicate(); + final ByteBuffer buffer = pointer.getBuffer(); fullLSN = pointer.getEndLSN(); assert buffer != null; - buffer.position(0); - copy.position(0); + assert buffer.position() == 0; + assert copy.position() == 0; - copy.put(buffer); + copy.put(0, buffer, 0, buffer.capacity()); removeFromDirtyPages(pageKey); @@ -3081,7 +3087,7 @@ private void flushExclusiveWriteCache(final CountDownLatch latch, long pagesToFl maxFullLogLSN = fullLSN; } - copy.position(0); + assert copy.position() == 0; if (!chunk.isEmpty()) { if (lastFileId != pointer.getFileId() @@ -3192,15 +3198,15 @@ public Void executeFileFlush(Set fileIdSet) throws InterruptedException continue; } try { - final ByteBuffer buffer = pagePointer.getBufferDuplicate(); + final ByteBuffer buffer = pagePointer.getBuffer(); final OPointer directPointer = bufferPool.acquireDirect(false, Intention.FILE_FLUSH); final ByteBuffer copy = directPointer.getNativeByteBuffer(); assert copy.position() == 0; assert buffer != null; - buffer.position(0); - copy.put(buffer); + assert buffer.position() == 0; + copy.put(0, buffer, 0, buffer.capacity()); final OLogSequenceNumber endLSN = pagePointer.getEndLSN(); diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/PeriodicFlushTask.java b/core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/PeriodicFlushTask.java index 09bca3262cc..dc6d6433b47 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/PeriodicFlushTask.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/PeriodicFlushTask.java @@ -1,11 +1,10 @@ package com.orientechnologies.orient.core.storage.cache.local; -final class PeriodicFlushTask implements Runnable { +public final class PeriodicFlushTask implements Runnable { /** */ private final OWOWCache owowCache; - /** @param owowCache */ public PeriodicFlushTask(OWOWCache owowCache) { this.owowCache = owowCache; } diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/cluster/v0/OPaginatedClusterV0.java b/core/src/main/java/com/orientechnologies/orient/core/storage/cluster/v0/OPaginatedClusterV0.java index dbe4f1c2f09..d97751be5f6 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/cluster/v0/OPaginatedClusterV0.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/cluster/v0/OPaginatedClusterV0.java @@ -1565,7 +1565,8 @@ private FindFreePageResult findFreePage( OLogManager.instance() .warn( this, - "Page in file %s with index %d was placed in wrong free list, this error will be fixed automatically", + "Page in file %s with index %d was placed in wrong free list, this error will" + + " be fixed automatically", getFullName(), pageIndex); diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/cluster/v2/OPaginatedClusterV2.java b/core/src/main/java/com/orientechnologies/orient/core/storage/cluster/v2/OPaginatedClusterV2.java index dc7de94f744..ead76e9df18 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/cluster/v2/OPaginatedClusterV2.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/cluster/v2/OPaginatedClusterV2.java @@ -206,9 +206,8 @@ public void open(OAtomicOperation atomicOperation) { OLogManager.instance() .infoNoDb( this, - "Free space map is absent inside of %s cluster" - + " of storage %s . Information about free space present inside of each page will " - + "be recovered.", + "Free space map is absent inside of %s cluster of storage %s . Information" + + " about free space present inside of each page will be recovered.", getName(), storageName); OLogManager.instance() diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/disk/OLocalPaginatedStorage.java b/core/src/main/java/com/orientechnologies/orient/core/storage/disk/OLocalPaginatedStorage.java index 8c29e3a1f0d..b551a13f182 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/disk/OLocalPaginatedStorage.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/disk/OLocalPaginatedStorage.java @@ -84,6 +84,7 @@ * @since 28.03.13 */ public class OLocalPaginatedStorage extends OAbstractPaginatedStorage { + @SuppressWarnings("WeakerAccess") protected static final long IV_SEED = 234120934; @@ -182,12 +183,7 @@ public void create(final OContextConfiguration contextConfiguration) { try { stateLock.writeLock().lock(); try { - final Path storageFolder = storagePath; - if (!Files.exists(storageFolder)) { - Files.createDirectories(storageFolder); - } - - super.create(contextConfiguration); + doCreate(contextConfiguration); } finally { stateLock.writeLock().unlock(); } @@ -200,14 +196,26 @@ public void create(final OContextConfiguration contextConfiguration) { } } + protected void doCreate(OContextConfiguration contextConfiguration) + throws IOException, InterruptedException { + final Path storageFolder = storagePath; + if (!Files.exists(storageFolder)) { + Files.createDirectories(storageFolder); + } + + super.doCreate(contextConfiguration); + } + @Override public final boolean exists() { try { - if (status == STATUS.OPEN || isInError() || status == STATUS.MIGRATION) return true; + if (status == STATUS.OPEN || isInError() || status == STATUS.MIGRATION) { + return true; + } return exists(storagePath); } catch (final RuntimeException e) { - throw logAndPrepareForRethrow(e, false); + throw logAndPrepareForRethrow(e); } catch (final Error e) { throw logAndPrepareForRethrow(e, false); } catch (final Throwable t) { @@ -239,16 +247,19 @@ public final List backup( final int bufferSize) { stateLock.readLock().lock(); try { - if (out == null) throw new IllegalArgumentException("Backup output is null"); + if (out == null) { + throw new IllegalArgumentException("Backup output is null"); + } freeze(false); try { - if (callable != null) + if (callable != null) { try { callable.call(); } catch (final Exception e) { OLogManager.instance().error(this, "Error on callback invocation during backup", e); } + } OLogSequenceNumber freezeLSN = null; if (writeAheadLog != null) { freezeLSN = writeAheadLog.begin(); @@ -289,7 +300,7 @@ public final List backup( release(); } } catch (final RuntimeException e) { - throw logAndPrepareForRethrow(e, false); + throw logAndPrepareForRethrow(e); } catch (final Error e) { throw logAndPrepareForRethrow(e, false); } catch (final Throwable t) { @@ -308,8 +319,8 @@ public final void restore( try { stateLock.writeLock().lock(); try { - if (!isClosed()) { - close(true, false); + if (!isClosedInternal()) { + doShutdown(); } final java.io.File dbDir = @@ -321,12 +332,13 @@ public final void restore( // TRY TO DELETE ALL THE FILES for (final java.io.File f : storageFiles) { // DELETE ONLY THE SUPPORTED FILES - for (final String ext : ALL_FILE_EXTENSIONS) + for (final String ext : ALL_FILE_EXTENSIONS) { if (f.getPath().endsWith(ext)) { //noinspection ResultOfMethodCallIgnored f.delete(); break; } + } } } Files.createDirectories(Paths.get(storagePath.toString())); @@ -352,22 +364,19 @@ public final void restore( } } - if (callable != null) + if (callable != null) { try { callable.call(); } catch (final Exception e) { OLogManager.instance().error(this, "Error on calling callback on database restore", e); } + } } finally { stateLock.writeLock().unlock(); } open(new OContextConfiguration()); - atomicOperationsManager.executeInsideAtomicOperation( - null, - (atomicOperation) -> { - generateDatabaseInstanceId(atomicOperation); - }); + atomicOperationsManager.executeInsideAtomicOperation(null, this::generateDatabaseInstanceId); } catch (final RuntimeException e) { throw logAndPrepareForRethrow(e); } catch (final Error e) { @@ -427,9 +436,10 @@ protected java.io.File createWalTempDirectory() { OFileUtils.deleteRecursively(walDirectory); } - if (!walDirectory.mkdirs()) + if (!walDirectory.mkdirs()) { throw new OStorageException( "Can not create temporary directory to store files created during incremental backup"); + } return walDirectory; } @@ -503,8 +513,9 @@ protected OWriteAheadLog createWalFromIBUFiles( @Override protected OStartupMetadata checkIfStorageDirty() throws IOException { - if (startupMetadata.exists()) startupMetadata.open(OConstants.getVersion()); - else { + if (startupMetadata.exists()) { + startupMetadata.open(OConstants.getVersion()); + } else { startupMetadata.create(OConstants.getVersion()); startupMetadata.makeDirty(OConstants.getVersion()); } @@ -548,11 +559,6 @@ protected Map preCloseSteps() { return params; } - @Override - protected void postCloseStepsAfterLock(final Map params) { - super.postCloseStepsAfterLock(params); - } - @Override protected void preCreateSteps() throws IOException { startupMetadata.create(OConstants.getVersion()); @@ -584,7 +590,9 @@ protected void postDeleteSteps() { public static void deleteFilesFromDisc( final String name, final int maxRetries, final int waitTime, final String databaseDirectory) { File dbDir = new java.io.File(databaseDirectory); - if (!dbDir.exists() || !dbDir.isDirectory()) dbDir = dbDir.getParentFile(); + if (!dbDir.exists() || !dbDir.isDirectory()) { + dbDir = dbDir.getParentFile(); + } // RETRIES for (int i = 0; i < maxRetries; ++i) { @@ -592,23 +600,26 @@ public static void deleteFilesFromDisc( int notDeletedFiles = 0; final File[] storageFiles = dbDir.listFiles(); - if (storageFiles == null) continue; + if (storageFiles == null) { + continue; + } // TRY TO DELETE ALL THE FILES for (final File f : storageFiles) { // DELETE ONLY THE SUPPORTED FILES - for (final String ext : ALL_FILE_EXTENSIONS) + for (final String ext : ALL_FILE_EXTENSIONS) { if (f.getPath().endsWith(ext)) { if (!f.delete()) { notDeletedFiles++; } break; } + } } if (notDeletedFiles == 0) { // TRY TO DELETE ALSO THE DIRECTORY IF IT'S EMPTY - if (!dbDir.delete()) + if (!dbDir.delete()) { OLogManager.instance() .error( OLocalPaginatedStorage.class, @@ -617,13 +628,17 @@ public static void deleteFilesFromDisc( + " because directory is not empty. Files: " + Arrays.toString(dbDir.listFiles()), null); + } return; } - } else return; + } else { + return; + } OLogManager.instance() .debug( OLocalPaginatedStorage.class, - "Cannot delete database files because they are still locked by the OrientDB process: waiting %d ms and retrying %d/%d...", + "Cannot delete database files because they are still locked by the OrientDB process:" + + " waiting %d ms and retrying %d/%d...", waitTime, i, maxRetries); diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/disk/OPeriodicFuzzyCheckpoint.java b/core/src/main/java/com/orientechnologies/orient/core/storage/disk/OPeriodicFuzzyCheckpoint.java index 6c193271416..d2ccbbb4a92 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/disk/OPeriodicFuzzyCheckpoint.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/disk/OPeriodicFuzzyCheckpoint.java @@ -6,7 +6,9 @@ public class OPeriodicFuzzyCheckpoint implements Runnable { /** */ private final OLocalPaginatedStorage storage; - /** @param storage */ + /** + * @param storage + */ public OPeriodicFuzzyCheckpoint(OLocalPaginatedStorage storage) { this.storage = storage; } diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/fs/AsyncFile.java b/core/src/main/java/com/orientechnologies/orient/core/storage/fs/AsyncFile.java index 58256920588..cb1ada88dfc 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/fs/AsyncFile.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/fs/AsyncFile.java @@ -26,6 +26,7 @@ import java.util.concurrent.atomic.AtomicLong; public final class AsyncFile implements OFile { + private final ScalableRWLock lock = new ScalableRWLock(); private volatile Path osFile; @@ -338,6 +339,7 @@ public void delete() throws IOException { try { doClose(); + OLogManager.instance().infoNoDb(this, "File " + osFile + " has been deleted."); Files.delete(osFile); } finally { lock.exclusiveUnlock(); @@ -391,6 +393,7 @@ private void checkForClose() { } private final class WriteHandler implements CompletionHandler { + private final ByteBuffer byteBuffer; private final AsyncIOResult ioResult; private final long position; @@ -429,6 +432,7 @@ public void failed(Throwable exc, CountDownLatch attachment) { } private static final class AsyncIOResult implements IOResult { + private final CountDownLatch latch; private Throwable exc; diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OAbstractPaginatedStorage.java b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OAbstractPaginatedStorage.java index e3ea4739bd7..3a31127858d 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OAbstractPaginatedStorage.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OAbstractPaginatedStorage.java @@ -27,6 +27,7 @@ import com.orientechnologies.common.concur.lock.ONotThreadRWLockManager; import com.orientechnologies.common.concur.lock.OPartitionedLockManager; import com.orientechnologies.common.concur.lock.OSimpleRWLockManager; +import com.orientechnologies.common.concur.lock.ScalableRWLock; import com.orientechnologies.common.exception.OException; import com.orientechnologies.common.exception.OHighLevelException; import com.orientechnologies.common.io.OIOException; @@ -210,7 +211,6 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Stream; @@ -227,6 +227,7 @@ public abstract class OAbstractPaginatedStorage OFreezableStorageComponent, OPageIsBrokenListener, OStorage { + private static final int WAL_RESTORE_REPORT_INTERVAL = 30 * 1000; // milliseconds private static final Comparator COMMIT_RECORD_OPERATION_COMPARATOR = @@ -247,10 +248,14 @@ public abstract class OAbstractPaginatedStorage parentThreadGroup = parentThreadGroup.getParent(); found = true; break; - } else parentThreadGroup = parentThreadGroup.getParent(); + } else { + parentThreadGroup = parentThreadGroup.getParent(); + } } - if (!found) parentThreadGroup = parentThreadGroupBackup; + if (!found) { + parentThreadGroup = parentThreadGroupBackup; + } storageThreadGroup = new ThreadGroup(parentThreadGroup, "OrientDB Storage"); @@ -308,13 +313,13 @@ public abstract class OAbstractPaginatedStorage private final OModifiableLong txRollback = new OModifiableLong(); private final AtomicInteger sessionCount = new AtomicInteger(0); - private final AtomicLong lastCloseTime = new AtomicLong(System.currentTimeMillis()); + private volatile long lastCloseTime = System.currentTimeMillis(); protected static final String DATABASE_INSTANCE_ID = "databaseInstenceId"; protected AtomicOperationsTable atomicOperationsTable; protected final String url; - protected final ReentrantReadWriteLock stateLock; + protected final ScalableRWLock stateLock; protected volatile OStorageConfiguration configuration; protected volatile OCurrentStorageComponentsFactory componentsFactory; @@ -334,7 +339,7 @@ public OAbstractPaginatedStorage( url = filePath; - stateLock = new ReentrantReadWriteLock(); + stateLock = new ScalableRWLock(); this.id = id; lockManager = new ONotThreadRWLockManager<>(); @@ -348,15 +353,18 @@ protected static String normalizeName(String name) { final int firstIndexOf = name.lastIndexOf('/'); final int secondIndexOf = name.lastIndexOf(java.io.File.separator); - if (firstIndexOf >= 0 || secondIndexOf >= 0) + if (firstIndexOf >= 0 || secondIndexOf >= 0) { return name.substring(Math.max(firstIndexOf, secondIndexOf) + 1); - else return name; + } else { + return name; + } } public static String checkName(String name) { name = normalizeName(name); - if (OStringSerializerHelper.contains(name, ',')) + if (OStringSerializerHelper.contains(name, ',')) { throw new IllegalArgumentException("Invalid character in storage name: " + name); + } return name; } @@ -378,7 +386,23 @@ public String getURL() { @Override public void close() { - close(false, false); + var sessions = sessionCount.decrementAndGet(); + + if (sessions < 0) { + throw new OStorageException( + "Amount of closed sessions in storage " + + name + + " is bigger than amount of open sessions"); + } + lastCloseTime = System.currentTimeMillis(); + } + + public long getSessionsCount() { + return sessionCount.get(); + } + + public long getLastCloseTime() { + return lastCloseTime; } @Override @@ -390,8 +414,11 @@ public boolean dropCluster(final String iClusterName) { public long countRecords() { long tot = 0; - for (OCluster c : getClusterInstances()) - if (c != null) tot += c.getEntries() - c.getTombstonesCount(); + for (OCluster c : getClusterInstances()) { + if (c != null) { + tot += c.getEntries() - c.getTombstonesCount(); + } + } return tot; } @@ -429,7 +456,17 @@ public long getVersion() { @Override public void shutdown() { - close(true, false); + stateLock.writeLock().lock(); + try { + doShutdown(); + } catch (final IOException e) { + final String message = "Error on closing of storage '" + name; + OLogManager.instance().error(this, message, e); + + throw OException.wrapException(new OStorageException(message), e); + } finally { + stateLock.writeLock().unlock(); + } } private static void checkPageSizeAndRelatedParametersInGlobalConfiguration() { @@ -470,12 +507,14 @@ public final void open(final OContextConfiguration contextConfiguration) { try { stateLock.readLock().lock(); try { - if (status == STATUS.OPEN || isInError()) - // ALREADY OPENED: THIS IS THE CASE WHEN A STORAGE INSTANCE IS - // REUSED - { + if (status == STATUS.OPEN || isInError()) { + // ALREADY OPENED: THIS IS THE CASE WHEN A STORAGE INSTANCE IS + // REUSED + + sessionCount.incrementAndGet(); return; } + } finally { stateLock.readLock().unlock(); } @@ -668,6 +707,10 @@ public final void open(final OContextConfiguration contextConfiguration) { throw logAndPrepareForRethrow(ee); } catch (final Throwable t) { throw logAndPrepareForRethrow(t); + } finally { + if (status == STATUS.OPEN) { + sessionCount.incrementAndGet(); + } } OLogManager.instance() @@ -694,7 +737,9 @@ private void initLockingStrategy(final OContextConfiguration contextConfiguratio } } - /** @inheritDoc */ + /** + * @inheritDoc + */ @Override public final String getCreatedAtVersion() { return configuration.getCreatedAtVersion(); @@ -797,121 +842,11 @@ private void checkRidBagsPresence(final OAtomicOperation operation) { @Override public void create(final OContextConfiguration contextConfiguration) { - checkPageSizeAndRelatedParametersInGlobalConfiguration(); + try { stateLock.writeLock().lock(); try { - if (name == null) { - throw new OInvalidDatabaseNameException("Database name can not be null"); - } - - if (name.isEmpty()) { - throw new OInvalidDatabaseNameException("Database name can not be empty"); - } - - final Pattern namePattern = Pattern.compile("[^\\w\\d$_-]+"); - final Matcher matcher = namePattern.matcher(name); - if (matcher.find()) { - throw new OInvalidDatabaseNameException( - "Only letters, numbers, `$`, `_` and `-` are allowed in database name. Provided name :`" - + name - + "`"); - } - - if (status != STATUS.CLOSED) { - throw new OStorageExistsException( - "Cannot create new storage '" + getURL() + "' because it is not closed"); - } - - if (exists()) { - throw new OStorageExistsException( - "Cannot create new storage '" + getURL() + "' because it already exists"); - } - - uuid = UUID.randomUUID(); - initLockingStrategy(contextConfiguration); - initIv(); - - initWalAndDiskCache(contextConfiguration); - - atomicOperationsTable = - new AtomicOperationsTable( - contextConfiguration.getValueAsInteger( - OGlobalConfiguration.STORAGE_ATOMIC_OPERATIONS_TABLE_COMPACTION_LIMIT), - idGen.getLastId() + 1); - atomicOperationsManager = - new OAtomicOperationsManager( - this, - contextConfiguration.getValueAsInteger( - OGlobalConfiguration.STORAGE_PAGE_OPERATIONS_CACHE_SIZE) - * 1024 - * 1024, - atomicOperationsTable); - transaction = new ThreadLocal<>(); - - preCreateSteps(); - makeStorageDirty(); - - atomicOperationsManager.executeInsideAtomicOperation( - null, - (atomicOperation) -> { - configuration = new OClusterBasedStorageConfiguration(this); - ((OClusterBasedStorageConfiguration) configuration) - .create(atomicOperation, contextConfiguration); - configuration.setUuid(atomicOperation, uuid.toString()); - - componentsFactory = new OCurrentStorageComponentsFactory(configuration); - - sbTreeCollectionManager.load(); - - status = STATUS.OPEN; - - sbTreeCollectionManager = new OSBTreeCollectionManagerShared(this); - - // ADD THE METADATA CLUSTER TO STORE INTERNAL STUFF - doAddCluster(atomicOperation, OMetadataDefault.CLUSTER_INTERNAL_NAME); - - ((OClusterBasedStorageConfiguration) configuration) - .setCreationVersion(atomicOperation, OConstants.getVersion()); - ((OClusterBasedStorageConfiguration) configuration) - .setPageSize( - atomicOperation, - OGlobalConfiguration.DISK_CACHE_PAGE_SIZE.getValueAsInteger() * 1024); - ((OClusterBasedStorageConfiguration) configuration) - .setMaxKeySize( - atomicOperation, - OGlobalConfiguration.SBTREE_MAX_KEY_SIZE.getValueAsInteger()); - - generateDatabaseInstanceId(atomicOperation); - - // ADD THE INDEX CLUSTER TO STORE, BY DEFAULT, ALL THE RECORDS OF - // INDEXING - doAddCluster(atomicOperation, OMetadataDefault.CLUSTER_INDEX_NAME); - - // ADD THE INDEX CLUSTER TO STORE, BY DEFAULT, ALL THE RECORDS OF - // INDEXING - doAddCluster(atomicOperation, OMetadataDefault.CLUSTER_MANUAL_INDEX_NAME); - - // ADD THE DEFAULT CLUSTER - defaultClusterId = doAddCluster(atomicOperation, CLUSTER_DEFAULT_NAME); - - clearStorageDirty(); - - postCreateSteps(); - - // binary compatibility with previous version, this record contained configuration of - // storage - doCreateRecord( - atomicOperation, - new ORecordId(0, -1), - new byte[] {0, 0, 0, 0}, - 0, - OBlob.RECORD_TYPE, - null, - doGetAndCheckCluster(0), - null); - }); - + doCreate(contextConfiguration); } catch (final InterruptedException e) { throw OException.wrapException( new OStorageException("Storage creation was interrupted"), e); @@ -941,6 +876,121 @@ public void create(final OContextConfiguration contextConfiguration) { OConstants.getVersion()); } + protected void doCreate(OContextConfiguration contextConfiguration) + throws IOException, InterruptedException { + checkPageSizeAndRelatedParametersInGlobalConfiguration(); + + if (name == null) { + throw new OInvalidDatabaseNameException("Database name can not be null"); + } + + if (name.isEmpty()) { + throw new OInvalidDatabaseNameException("Database name can not be empty"); + } + + final Pattern namePattern = Pattern.compile("[^\\w\\d$_-]+"); + final Matcher matcher = namePattern.matcher(name); + if (matcher.find()) { + throw new OInvalidDatabaseNameException( + "Only letters, numbers, `$`, `_` and `-` are allowed in database name. Provided name :`" + + name + + "`"); + } + + if (status != STATUS.CLOSED) { + throw new OStorageExistsException( + "Cannot create new storage '" + getURL() + "' because it is not closed"); + } + + if (exists()) { + throw new OStorageExistsException( + "Cannot create new storage '" + getURL() + "' because it already exists"); + } + + uuid = UUID.randomUUID(); + initLockingStrategy(contextConfiguration); + initIv(); + + initWalAndDiskCache(contextConfiguration); + + atomicOperationsTable = + new AtomicOperationsTable( + contextConfiguration.getValueAsInteger( + OGlobalConfiguration.STORAGE_ATOMIC_OPERATIONS_TABLE_COMPACTION_LIMIT), + idGen.getLastId() + 1); + atomicOperationsManager = + new OAtomicOperationsManager( + this, + contextConfiguration.getValueAsInteger( + OGlobalConfiguration.STORAGE_PAGE_OPERATIONS_CACHE_SIZE) + * 1024 + * 1024, + atomicOperationsTable); + transaction = new ThreadLocal<>(); + + preCreateSteps(); + makeStorageDirty(); + + atomicOperationsManager.executeInsideAtomicOperation( + null, + (atomicOperation) -> { + configuration = new OClusterBasedStorageConfiguration(this); + ((OClusterBasedStorageConfiguration) configuration) + .create(atomicOperation, contextConfiguration); + configuration.setUuid(atomicOperation, uuid.toString()); + + componentsFactory = new OCurrentStorageComponentsFactory(configuration); + + sbTreeCollectionManager.load(); + + status = STATUS.OPEN; + + sbTreeCollectionManager = new OSBTreeCollectionManagerShared(this); + + // ADD THE METADATA CLUSTER TO STORE INTERNAL STUFF + doAddCluster(atomicOperation, OMetadataDefault.CLUSTER_INTERNAL_NAME); + + ((OClusterBasedStorageConfiguration) configuration) + .setCreationVersion(atomicOperation, OConstants.getVersion()); + ((OClusterBasedStorageConfiguration) configuration) + .setPageSize( + atomicOperation, + OGlobalConfiguration.DISK_CACHE_PAGE_SIZE.getValueAsInteger() * 1024); + ((OClusterBasedStorageConfiguration) configuration) + .setMaxKeySize( + atomicOperation, OGlobalConfiguration.SBTREE_MAX_KEY_SIZE.getValueAsInteger()); + + generateDatabaseInstanceId(atomicOperation); + + // ADD THE INDEX CLUSTER TO STORE, BY DEFAULT, ALL THE RECORDS OF + // INDEXING + doAddCluster(atomicOperation, OMetadataDefault.CLUSTER_INDEX_NAME); + + // ADD THE INDEX CLUSTER TO STORE, BY DEFAULT, ALL THE RECORDS OF + // INDEXING + doAddCluster(atomicOperation, OMetadataDefault.CLUSTER_MANUAL_INDEX_NAME); + + // ADD THE DEFAULT CLUSTER + defaultClusterId = doAddCluster(atomicOperation, CLUSTER_DEFAULT_NAME); + + clearStorageDirty(); + + postCreateSteps(); + + // binary compatibility with previous version, this record contained configuration of + // storage + doCreateRecord( + atomicOperation, + new ORecordId(0, -1), + new byte[] {0, 0, 0, 0}, + 0, + OBlob.RECORD_TYPE, + null, + doGetAndCheckCluster(0), + null); + }); + } + protected void generateDatabaseInstanceId(OAtomicOperation atomicOperation) { ((OClusterBasedStorageConfiguration) configuration) .setProperty(atomicOperation, DATABASE_INSTANCE_ID, UUID.randomUUID().toString()); @@ -1004,12 +1054,12 @@ public final boolean isClosed() { try { stateLock.readLock().lock(); try { - return status == STATUS.CLOSED; + return isClosedInternal(); } finally { stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -1017,10 +1067,19 @@ public final boolean isClosed() { } } + protected final boolean isClosedInternal() { + return status == STATUS.CLOSED; + } + @Override - public final void close(final boolean force, final boolean onDelete) { + public final void close(final boolean force) { try { - doClose(force, onDelete); + if (!force) { + close(); + return; + } + + doShutdown(); } catch (final RuntimeException ee) { throw logAndPrepareForRethrow(ee); } catch (final Error ee) { @@ -1034,14 +1093,9 @@ public final void close(final boolean force, final boolean onDelete) { public final void delete() { try { final long timer = Orient.instance().getProfiler().startChrono(); - stateLock.writeLock().lock(); try { - makeStorageDirty(); - - // CLOSE THE DATABASE BY REMOVING THE CURRENT USER - close(true, true); - postDeleteSteps(); + doDelete(); } finally { stateLock.writeLock().unlock(); Orient.instance() @@ -1057,6 +1111,14 @@ public final void delete() { } } + private void doDelete() throws IOException { + makeStorageDirty(); + + // CLOSE THE DATABASE BY REMOVING THE CURRENT USER + doShutdownOnDelete(); + postDeleteSteps(); + } + public boolean check(final boolean verbose, final OCommandOutputListener listener) { try { listener.onMessage("Check of storage is started..."); @@ -1089,7 +1151,7 @@ public boolean check(final boolean verbose, final OCommandOutputListener listene stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -1255,7 +1317,7 @@ public String getClusterNameById(int clusterId) { } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -1282,7 +1344,7 @@ public long getClusterRecordsSizeById(int clusterId) { stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -1310,7 +1372,7 @@ public long getClusterRecordsSizeByName(String clusterName) { stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -1339,7 +1401,7 @@ public String getClusterRecordConflictStrategy(int clusterId) { stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -1366,7 +1428,7 @@ public String getClusterEncryption(int clusterId) { stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -1393,7 +1455,7 @@ public boolean isSystemCluster(int clusterId) { stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -1420,7 +1482,7 @@ public long getLastClusterPosition(int clusterId) { stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -1447,7 +1509,7 @@ public long getClusterNextPosition(int clusterId) { stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -1475,7 +1537,7 @@ public OPaginatedCluster.RECORD_STATUS getRecordStatus(ORID rid) { stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -1594,7 +1656,7 @@ public final long count(final int clusterId, final boolean countTombstones) { stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -1629,7 +1691,7 @@ public final long[] getClusterDataRange(final int iClusterId) { stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -1641,7 +1703,7 @@ public OLogSequenceNumber getLSN() { try { return writeAheadLog.end(); } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -1807,7 +1869,7 @@ public final long count(final int[] iClusterIds, final boolean countTombstones) stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -1892,7 +1954,7 @@ public final ORecordMetadata getRecordMetadata(final ORID rid) { return null; } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -1926,7 +1988,7 @@ public boolean isDeleted(final ORID rid) { return false; } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -1978,7 +2040,7 @@ public OClusterBrowsePage next() { stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -1999,7 +2061,7 @@ private OClusterBrowsePage nextPage(final int clusterId, final long lastPosition stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -2027,7 +2089,7 @@ public OStorageOperationResult readRecord( try { return new OStorageOperationResult<>(readRecord(rid, prefetchRecords)); } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -2045,7 +2107,7 @@ public final OStorageOperationResult readRecordIfVersionIsNotLatest( try { return new OStorageOperationResult<>(readRecordIfNotLatest(rid, recordVersion)); } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -2160,7 +2222,7 @@ public final Set getClusterNames() { stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -2175,7 +2237,7 @@ public final int getClusterIdByName(final String clusterName) { throw new IllegalArgumentException("Cluster name is null"); } - if (clusterName.length() == 0) { + if (clusterName.isEmpty()) { throw new IllegalArgumentException("Cluster name is empty"); } @@ -2196,7 +2258,7 @@ public final int getClusterIdByName(final String clusterName) { stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -2439,7 +2501,8 @@ protected List commit( new OPhysicalPosition(rec.getIdentity().getClusterPosition())); } else { throw new OStorageException( - "Impossible to commit a transaction with not valid rid in pre-allocated commit"); + "Impossible to commit a transaction with not valid rid in pre-allocated" + + " commit"); } } else if (rec.isDirty() && !rec.getIdentity().isPersistent()) { final ORecordId rid = (ORecordId) rec.getIdentity().copy(); @@ -2583,8 +2646,11 @@ private void applyTxChanges(OTransactionIndexChangesPerKey changes, OIndexIntern index.doPut(this, changes.key, op.getValue().getIdentity()); break; case REMOVE: - if (op.getValue() != null) index.doRemove(this, changes.key, op.getValue().getIdentity()); - else index.doRemove(this, changes.key); + if (op.getValue() != null) { + index.doRemove(this, changes.key, op.getValue().getIdentity()); + } else { + index.doRemove(this, changes.key); + } break; case CLEAR: // SHOULD NEVER BE THE CASE HANDLE BY cleared FLAG @@ -2612,7 +2678,7 @@ public int loadIndexEngine(final String name) { stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -2685,7 +2751,7 @@ public int loadExternalIndexEngine( stateLock.writeLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -2739,7 +2805,7 @@ public int addIndexEngine( .deleteIndexEngine(atomicOperation, indexMetadata.getName()); } } - final int binaryFormatVersion = getConfiguration().getBinaryFormatVersion(); + final int binaryFormatVersion = configuration.getBinaryFormatVersion(); final byte valueSerializerId = indexMetadata.getValueSerializerId(binaryFormatVersion); final OContextConfiguration ctxCfg = configuration.getContextConfiguration(); @@ -2805,7 +2871,7 @@ public OBinarySerializer resolveObjectSerializer(final byte serializerId) { public static OEncryption loadEncryption( final String cfgEncryption, final String cfgEncryptionKey) { final OEncryption encryption; - if (cfgEncryption == null || cfgEncryption.toLowerCase().equals(ONothingEncryption.NAME)) { + if (cfgEncryption == null || cfgEncryption.equalsIgnoreCase(ONothingEncryption.NAME)) { encryption = null; } else { encryption = OEncryptionFactory.INSTANCE.getEncryption(cfgEncryption, cfgEncryptionKey); @@ -2981,7 +3047,8 @@ private boolean removeKeyFromIndexInternal( return ((OSingleValueIndexEngine) engine).remove(atomicOperation, key); } else { throw new OStorageException( - "To remove entry from multi-value index not only key but value also should be provided"); + "To remove entry from multi-value index not only key but value also should be" + + " provided"); } } } catch (final IOException e) { @@ -3057,7 +3124,7 @@ public Object getIndexValue(int indexId, final Object key) throws OInvalidIndexE } catch (final OInvalidIndexEngineIdException ie) { throw logAndPrepareForRethrow(ie); } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -3105,7 +3172,7 @@ public Stream getIndexValues(int indexId, final Object key) } catch (final OInvalidIndexEngineIdException ie) { throw logAndPrepareForRethrow(ie); } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -3145,7 +3212,7 @@ public OBaseIndexEngine getIndexEngine(int indexId) throws OInvalidIndexEngineId } catch (final OInvalidIndexEngineIdException ie) { throw logAndPrepareForRethrow(ie); } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -3201,7 +3268,7 @@ public T callIndexEngine( } catch (final OInvalidIndexEngineIdException ie) { throw logAndPrepareForRethrow(ie); } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -3449,7 +3516,7 @@ public Stream> iterateIndexEntriesBetween( } catch (final OInvalidIndexEngineIdException ie) { throw logAndPrepareForRethrow(ie); } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -3501,7 +3568,7 @@ public Stream> iterateIndexEntriesMajor( } catch (final OInvalidIndexEngineIdException ie) { throw logAndPrepareForRethrow(ie); } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -3550,7 +3617,7 @@ public Stream> iterateIndexEntriesMinor( } catch (final OInvalidIndexEngineIdException ie) { throw logAndPrepareForRethrow(ie); } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -3595,7 +3662,7 @@ public Stream> getIndexStream( } catch (final OInvalidIndexEngineIdException ie) { throw logAndPrepareForRethrow(ie); } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -3636,7 +3703,7 @@ public Stream> getIndexDescStream( } catch (final OInvalidIndexEngineIdException ie) { throw logAndPrepareForRethrow(ie); } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -3675,7 +3742,7 @@ public Stream getIndexKeyStream(int indexId) throws OInvalidIndexEngineI } catch (final OInvalidIndexEngineIdException ie) { throw logAndPrepareForRethrow(ie); } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -3714,7 +3781,7 @@ public long getIndexSize(int indexId, final IndexEngineValuesTransformer transfo } catch (final OInvalidIndexEngineIdException ie) { throw logAndPrepareForRethrow(ie); } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -3752,7 +3819,7 @@ public boolean hasIndexRangeQuerySupport(int indexId) throws OInvalidIndexEngine } catch (final OInvalidIndexEngineIdException ie) { throw logAndPrepareForRethrow(ie); } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -3796,7 +3863,7 @@ public final boolean checkForRecordValidity(final OPhysicalPosition ppos) { try { return ppos != null && !ORecordVersionHelper.isTombstone(ppos.recordVersion); } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -3876,7 +3943,7 @@ public final String getPhysicalClusterNameById(final int iClusterId) { stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -3908,7 +3975,7 @@ public String getClusterName(int clusterId) { return doGetAndCheckCluster(clusterId).getName(); } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -3943,7 +4010,7 @@ public final long getSize() { throw OException.wrapException(new OStorageException("Cannot calculate records size"), ioe); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -3964,7 +4031,7 @@ public final int getClusters() { stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -3995,7 +4062,7 @@ public final Set getClusterInstances() { stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -4097,7 +4164,7 @@ public final void reload() { close(); open(new OContextConfiguration()); } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -4110,7 +4177,9 @@ public String getMode() { return "rw"; } - /** @inheritDoc */ + /** + * @inheritDoc + */ @Override public final void pageIsBroken(final String fileName, final long pageIndex) { OLogManager.instance() @@ -4152,7 +4221,7 @@ public final void requestCheckpoint() { /** Executes the command request and return the result back. */ @Override - public final Object command(final OCommandRequestText iCommand) { + public final Object command(final OCommandRequestText command) { try { final ODatabaseDocumentInternal db = ODatabaseRecordThreadLocal.instance().get(); while (true) { @@ -4162,21 +4231,20 @@ public final Object command(final OCommandRequestText iCommand) { .getOrientDB() .getScriptManager() .getCommandManager() - .getExecutor(iCommand); + .getExecutor(command); // COPY THE CONTEXT FROM THE REQUEST - executor.setContext(iCommand.getContext()); - executor.setProgressListener(iCommand.getProgressListener()); - executor.parse(iCommand); - return executeCommand(iCommand, executor); + executor.setContext(command.getContext()); + executor.setProgressListener(command.getProgressListener()); + executor.parse(command); + return executeCommand(command, executor); } catch (final ORetryQueryException ignore) { - if (iCommand instanceof OQueryAbstract) { - final OQueryAbstract query = (OQueryAbstract) iCommand; + if (command instanceof OQueryAbstract query) { query.reset(); } } } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -4239,7 +4307,7 @@ public final Object executeCommand( } } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -4271,7 +4339,7 @@ public final OPhysicalPosition[] higherPhysicalPositions( stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -4303,7 +4371,7 @@ public final OPhysicalPosition[] ceilingPhysicalPositions( stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -4336,7 +4404,7 @@ public final OPhysicalPosition[] lowerPhysicalPositions( stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -4368,7 +4436,7 @@ public final OPhysicalPosition[] floorPhysicalPositions( stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { @@ -4379,7 +4447,8 @@ public final OPhysicalPosition[] floorPhysicalPositions( public void acquireWriteLock(final ORID rid, final long timeout) { if (!modificationLock) { throw new ODatabaseException( - "Record write locks are off by configuration, set the configuration \"storage.pessimisticLock\" to \"" + "Record write locks are off by configuration, set the configuration" + + " \"storage.pessimisticLock\" to \"" + OrientDBConfig.LOCK_TYPE_READWRITE + "\" for enable them"); } @@ -4398,7 +4467,8 @@ public void acquireWriteLock(final ORID rid, final long timeout) { public final void acquireWriteLock(final ORID rid) { if (!modificationLock) { throw new ODatabaseException( - "Record write locks are off by configuration, set the configuration \"storage.pessimisticLock\" to \"" + "Record write locks are off by configuration, set the configuration" + + " \"storage.pessimisticLock\" to \"" + OrientDBConfig.LOCK_TYPE_MODIFICATION + "\" for enable them"); } @@ -4429,7 +4499,8 @@ public final void releaseWriteLock(final ORID rid) { public final void acquireReadLock(final ORID rid) { if (!readLock) { throw new ODatabaseException( - "Record read locks are off by configuration, set the configuration \"storage.pessimisticLock\" to \"" + "Record read locks are off by configuration, set the configuration" + + " \"storage.pessimisticLock\" to \"" + OrientDBConfig.LOCK_TYPE_READWRITE + "\" for enable them"); } @@ -4448,7 +4519,8 @@ public final void acquireReadLock(final ORID rid) { public void acquireReadLock(final ORID rid, final long timeout) { if (!readLock) { throw new ODatabaseException( - "Record read locks are off by configuration, set the configuration \"storage.pessimisticLock\" to \"" + "Record read locks are off by configuration, set the configuration" + + " \"storage.pessimisticLock\" to \"" + OrientDBConfig.LOCK_TYPE_READWRITE + "\" for enable them"); } @@ -4587,7 +4659,8 @@ public void checkErrorState() { new OStorageException( "Internal error happened in storage " + name - + " please restart the server or re-open the storage to undergo the restore process and fix the error."), + + " please restart the server or re-open the storage to undergo the restore" + + " process and fix the error."), this.error.get()); } } @@ -4759,9 +4832,6 @@ protected abstract void postCloseSteps( @SuppressWarnings("unused") boolean onDelete, boolean internalError, long lastTxId) throws IOException; - @SuppressWarnings("EmptyMethod") - protected void postCloseStepsAfterLock(final Map params) {} - @SuppressWarnings({"EmptyMethod"}) protected Map preCloseSteps() { return new HashMap<>(2); @@ -5284,7 +5354,7 @@ private int doAddCluster( OPaginatedClusterFactory.createCluster( clusterName, configuration.getVersion(), - getConfiguration() + configuration .getContextConfiguration() .getValueAsInteger(OGlobalConfiguration.STORAGE_CLUSTER_VERSION), this); @@ -5403,22 +5473,9 @@ private boolean dropClusterInternal(final OAtomicOperation atomicOperation, fina return false; } - private void doClose(final boolean force, final boolean onDelete) { - if (!force && !onDelete) { - decOnClose(); - return; - } - - if (status == STATUS.CLOSED) { - return; - } - + protected void doShutdown() throws IOException { final long timer = Orient.instance().getProfiler().startChrono(); - Map params = new HashMap<>(2); - - stateLock.writeLock().lock(); try { - if (status == STATUS.CLOSED) { return; } @@ -5432,44 +5489,26 @@ private void doClose(final boolean force, final boolean onDelete) { status = STATUS.CLOSING; if (!isInError()) { - if (!onDelete) { - flushAllData(); - } - - params = preCloseSteps(); + flushAllData(); + preCloseSteps(); - if (!onDelete) { - atomicOperationsManager.executeInsideAtomicOperation( - null, - atomicOperation -> { - // we close all files inside cache system so we only clear index metadata and close - // non core indexes - for (final OBaseIndexEngine engine : indexEngines) { - if (engine != null - && !(engine instanceof OSBTreeIndexEngine - || engine instanceof OHashTableIndexEngine - || engine instanceof OCellBTreeSingleValueIndexEngine - || engine instanceof OCellBTreeMultiValueIndexEngine - || engine instanceof OAutoShardingIndexEngine)) { - engine.close(); - } + atomicOperationsManager.executeInsideAtomicOperation( + null, + atomicOperation -> { + // we close all files inside cache system so we only clear index metadata and close + // non core indexes + for (final OBaseIndexEngine engine : indexEngines) { + if (engine != null + && !(engine instanceof OSBTreeIndexEngine + || engine instanceof OHashTableIndexEngine + || engine instanceof OCellBTreeSingleValueIndexEngine + || engine instanceof OCellBTreeMultiValueIndexEngine + || engine instanceof OAutoShardingIndexEngine)) { + engine.close(); } - ((OClusterBasedStorageConfiguration) configuration).close(atomicOperation); - }); - } else { - for (final OBaseIndexEngine engine : indexEngines) { - if (engine != null - && !(engine instanceof OSBTreeIndexEngine - || engine instanceof OHashTableIndexEngine - || engine instanceof OCellBTreeSingleValueIndexEngine - || engine instanceof OCellBTreeMultiValueIndexEngine - || engine instanceof OAutoShardingIndexEngine)) { - // delete method is implemented only in non native indexes, so they do not use ODB - // atomic operation - engine.delete(null); - } - } - } + } + ((OClusterBasedStorageConfiguration) configuration).close(atomicOperation); + }); sbTreeCollectionManager.close(); @@ -5487,19 +5526,79 @@ private void doClose(final boolean force, final boolean onDelete) { writeAheadLog.removeCheckpointListener(this); if (readCache != null) { - if (!onDelete) { - readCache.closeStorage(writeCache); - } else { - readCache.deleteStorage(writeCache); + readCache.closeStorage(writeCache); + } + + writeAheadLog.close(); + } else { + OLogManager.instance() + .errorNoDb( + this, + "Because of JVM error happened inside of storage it can not be properly closed", + null); + } + + postCloseSteps(false, isInError(), idGen.getLastId()); + transaction = null; + lastMetadata = null; + migration = new CountDownLatch(1); + status = STATUS.CLOSED; + } finally { + Orient.instance() + .getProfiler() + .stopChrono("db." + name + ".close", "Close a database", timer, "db.*.close"); + } + } + + private void doShutdownOnDelete() { + if (status == STATUS.CLOSED) { + return; + } + + if (status != STATUS.OPEN && !isInError()) { + throw OException.wrapException( + new OStorageException("Storage " + name + " was not opened, so can not be closed"), + this.error.get()); + } + + status = STATUS.CLOSING; + try { + if (!isInError()) { + preCloseSteps(); + + for (final OBaseIndexEngine engine : indexEngines) { + if (engine != null + && !(engine instanceof OSBTreeIndexEngine + || engine instanceof OHashTableIndexEngine + || engine instanceof OCellBTreeSingleValueIndexEngine + || engine instanceof OCellBTreeMultiValueIndexEngine + || engine instanceof OAutoShardingIndexEngine)) { + // delete method is implemented only in non native indexes, so they do not use ODB + // atomic operation + engine.delete(null); } } - if (onDelete) { - writeAheadLog.delete(); - } else { - writeAheadLog.close(); + sbTreeCollectionManager.close(); + + // we close all files inside cache system so we only clear cluster metadata + clusters.clear(); + clusterMap.clear(); + indexEngines.clear(); + indexEngineNameMap.clear(); + + if (writeCache != null) { + writeCache.removeBackgroundExceptionListener(this); + writeCache.removePageIsBrokenListener(this); } + writeAheadLog.removeCheckpointListener(this); + + if (readCache != null) { + readCache.deleteStorage(writeCache); + } + + writeAheadLog.delete(); } else { OLogManager.instance() .errorNoDb( @@ -5507,7 +5606,7 @@ private void doClose(final boolean force, final boolean onDelete) { "Because of JVM error happened inside of storage it can not be properly closed", null); } - postCloseSteps(onDelete, isInError(), idGen.getLastId()); + postCloseSteps(true, isInError(), idGen.getLastId()); transaction = null; lastMetadata = null; migration = new CountDownLatch(1); @@ -5517,15 +5616,7 @@ private void doClose(final boolean force, final boolean onDelete) { OLogManager.instance().error(this, message, e); throw OException.wrapException(new OStorageException(message), e); - - } finally { - Orient.instance() - .getProfiler() - .stopChrono("db." + name + ".close", "Close a database", timer, "db.*.close"); - stateLock.writeLock().unlock(); } - - postCloseStepsAfterLock(params); } @SuppressWarnings("unused") @@ -5825,8 +5916,7 @@ protected OLogSequenceNumber restoreFrom(OWriteAheadLog writeAheadLog, OLogSeque while (!records.isEmpty()) { for (final WriteableWALRecord walRecord : records) { - if (walRecord instanceof OAtomicUnitEndRecord) { - final OAtomicUnitEndRecord atomicUnitEndRecord = (OAtomicUnitEndRecord) walRecord; + if (walRecord instanceof OAtomicUnitEndRecord atomicUnitEndRecord) { final List atomicUnit = operationUnits.remove(atomicUnitEndRecord.getOperationUnitId()); @@ -5844,7 +5934,7 @@ protected OLogSequenceNumber restoreFrom(OWriteAheadLog writeAheadLog, OLogSeque if (metadata != null) { this.lastMetadata = metadata; } - } else if (walRecord instanceof OAtomicUnitStartRecord) { + } else if (walRecord instanceof OAtomicUnitStartRecord oAtomicUnitStartRecord) { if (walRecord instanceof OAtomicUnitStartMetadataRecord) { byte[] metadata = ((OAtomicUnitStartMetadataRecord) walRecord).getMetadata(); operationMetadata.put( @@ -5853,15 +5943,11 @@ protected OLogSequenceNumber restoreFrom(OWriteAheadLog writeAheadLog, OLogSeque final List operationList = new ArrayList<>(1024); - assert !operationUnits.containsKey( - ((OAtomicUnitStartRecord) walRecord).getOperationUnitId()); + assert !operationUnits.containsKey(oAtomicUnitStartRecord.getOperationUnitId()); - operationUnits.put( - ((OAtomicUnitStartRecord) walRecord).getOperationUnitId(), operationList); + operationUnits.put(oAtomicUnitStartRecord.getOperationUnitId(), operationList); operationList.add(walRecord); - } else if (walRecord instanceof OOperationUnitRecord) { - final OOperationUnitRecord operationUnitRecord = (OOperationUnitRecord) walRecord; - + } else if (walRecord instanceof OOperationUnitRecord operationUnitRecord) { List operationList = operationUnits.get(operationUnitRecord.getOperationUnitId()); @@ -5877,16 +5963,16 @@ protected OLogSequenceNumber restoreFrom(OWriteAheadLog writeAheadLog, OLogSeque } operationList.add(operationUnitRecord); - } else if (walRecord instanceof ONonTxOperationPerformedWALRecord) { + } else if (walRecord instanceof ONonTxOperationPerformedWALRecord ignored) { if (!wereNonTxOperationsPerformedInPreviousOpen) { OLogManager.instance() .warnNoDb( this, - "Non tx operation was used during data modification we will need index rebuild."); + "Non tx operation was used during data modification we will need index" + + " rebuild."); wereNonTxOperationsPerformedInPreviousOpen = true; } - } else if (walRecord instanceof MetaDataRecord) { - final MetaDataRecord metaDataRecord = (MetaDataRecord) walRecord; + } else if (walRecord instanceof MetaDataRecord metaDataRecord) { this.lastMetadata = metaDataRecord.getMetadata(); lastUpdatedLSN = walRecord.getLsn(); } else { @@ -5916,13 +6002,15 @@ protected OLogSequenceNumber restoreFrom(OWriteAheadLog writeAheadLog, OLogSeque OLogManager.instance() .errorNoDb( this, - "Data restore was paused because broken WAL page was found. The rest of changes will be rolled back.", + "Data restore was paused because broken WAL page was found. The rest of changes will" + + " be rolled back.", e); } catch (final RuntimeException e) { OLogManager.instance() .errorNoDb( this, - "Data restore was paused because of exception. The rest of changes will be rolled back.", + "Data restore was paused because of exception. The rest of changes will be rolled" + + " back.", e); } @@ -5939,9 +6027,7 @@ protected final boolean restoreAtomicUnit( AtomicUnitEndRecordWithPageLSNs atomicUnitEndRecord = null; for (final OWALRecord walRecord : atomicUnit) { - if (walRecord instanceof OUpdatePageRecord) { - final OUpdatePageRecord record = (OUpdatePageRecord) walRecord; - + if (walRecord instanceof OUpdatePageRecord record) { final long fileId = record.getFileId(); final long pageIndex = record.getPageIndex(); @@ -6029,23 +6115,18 @@ protected final boolean restoreAtomicUnit( } for (final OWALRecord walRecord : atomicUnit) { - if (walRecord instanceof OFileDeletedWALRecord) { - final OFileDeletedWALRecord fileDeletedWALRecord = (OFileDeletedWALRecord) walRecord; + if (walRecord instanceof OFileDeletedWALRecord fileDeletedWALRecord) { if (writeCache.exists(fileDeletedWALRecord.getFileId())) { readCache.deleteFile(fileDeletedWALRecord.getFileId(), writeCache); } - } else if (walRecord instanceof OFileCreatedWALRecord) { - final OFileCreatedWALRecord fileCreatedCreatedWALRecord = (OFileCreatedWALRecord) walRecord; - + } else if (walRecord instanceof OFileCreatedWALRecord fileCreatedCreatedWALRecord) { if (!writeCache.exists(fileCreatedCreatedWALRecord.getFileName())) { readCache.addFile( fileCreatedCreatedWALRecord.getFileName(), fileCreatedCreatedWALRecord.getFileId(), writeCache); } - } else if (walRecord instanceof OUpdatePageRecord) { - final OUpdatePageRecord updatePageRecord = (OUpdatePageRecord) walRecord; - + } else if (walRecord instanceof OUpdatePageRecord updatePageRecord) { long fileId = updatePageRecord.getFileId(); if (!writeCache.exists(fileId)) { final String fileName = writeCache.restoreFileById(fileId); @@ -6100,6 +6181,7 @@ protected final boolean restoreAtomicUnit( //noinspection UnnecessaryContinue continue; } else { + assert walRecord != null; OLogManager.instance() .error( this, @@ -6321,21 +6403,11 @@ private void registerProfilerHooks() { "db.*.txRollback"); } - protected final RuntimeException logAndPrepareForRethrow( - final RuntimeException runtimeException) { - return logAndPrepareForRethrow(runtimeException, false); - } - - protected RuntimeException logAndPrepareForRethrow( - final RuntimeException runtimeException, final boolean putInReadOnlyMode) { + protected RuntimeException logAndPrepareForRethrow(final RuntimeException runtimeException) { if (!(runtimeException instanceof OHighLevelException || runtimeException instanceof ONeedRetryException || runtimeException instanceof OInternalErrorException || runtimeException instanceof IllegalArgumentException)) { - if (putInReadOnlyMode) { - setInError(runtimeException); - } - OLogManager.instance() .errorStorage( this, @@ -6411,12 +6483,7 @@ private OInvalidIndexEngineIdException logAndPrepareForRethrow( @Override public final OStorageConfiguration getConfiguration() { - stateLock.readLock().lock(); - try { - return configuration; - } finally { - stateLock.readLock().unlock(); - } + return configuration; } @Override @@ -6842,11 +6909,7 @@ void runWALVacuum() { final long activeSegment = writeAheadLog.activeSegment(); final Long minLSNSegment = writeCache.getMinimalNotFlushedSegment(); - if (minLSNSegment == null) { - minDirtySegment = activeSegment; - } else { - minDirtySegment = minLSNSegment; - } + minDirtySegment = Objects.requireNonNullElse(minLSNSegment, activeSegment); } while (minDirtySegment < flushTillSegmentId); atomicOperationsTable.compactTable(); @@ -6870,23 +6933,6 @@ void runWALVacuum() { } } - public void incOnOpen() { - sessionCount.incrementAndGet(); - } - - private void decOnClose() { - lastCloseTime.set(System.currentTimeMillis()); - sessionCount.decrementAndGet(); - } - - public int getSessionCount() { - return sessionCount.get(); - } - - public long getLastCloseTime() { - return lastCloseTime.get(); - } - public int getVersionForKey(final String indexName, final Object key) { assert isIndexUniqueByName(indexName); if (!isDistributedMode(lastMetadata)) { @@ -6914,13 +6960,6 @@ private boolean isIndexUniqueByType(final String indexType) { || indexType.equals(OClass.INDEX_TYPE.DICTIONARY_HASH_INDEX.name()); } - private void applyUniqueIndexChanges( - final String indexName, final OTransactionIndexChanges changes) { - for (final OTransactionIndexChangesPerKey changePerKey : changes.changesPerKey.values()) { - this.applyUniqueIndexChange(indexName, changePerKey.key); - } - } - private void applyUniqueIndexChange(final String indexName, final Object key) { if (!isDistributedMode(lastMetadata)) { final OBaseIndexEngine indexEngine = indexEngineNameMap.get(indexName); @@ -6943,7 +6982,7 @@ public int[] getClustersIds(Set filterClusters) { throw new IllegalArgumentException("Cluster name is null"); } - if (clusterName.length() == 0) { + if (clusterName.isEmpty()) { throw new IllegalArgumentException("Cluster name is empty"); } @@ -6961,7 +7000,7 @@ public int[] getClustersIds(Set filterClusters) { stateLock.readLock().unlock(); } } catch (final RuntimeException ee) { - throw logAndPrepareForRethrow(ee, false); + throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee, false); } catch (final Throwable t) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OStorageConfigurationSegment.java b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OStorageConfigurationSegment.java index c783d78f775..986732cd6b6 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OStorageConfigurationSegment.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OStorageConfigurationSegment.java @@ -135,7 +135,8 @@ public OStorageConfigurationImpl load(final OContextConfiguration configuration) OLogManager.instance() .warnNoDb( this, - "Main storage configuration file %s is broken in storage %s, try to read from backup file %s", + "Main storage configuration file %s is broken in storage %s, try to read from" + + " backup file %s", file, storageName, backupFile); @@ -159,8 +160,8 @@ public OStorageConfigurationImpl load(final OContextConfiguration configuration) OLogManager.instance() .warn( this, - "Seems like previous update to the storage '%s' configuration was finished incorrectly, " - + "main configuration file %s is absent, reading from backup", + "Seems like previous update to the storage '%s' configuration was finished" + + " incorrectly, main configuration file %s is absent, reading from backup", backupFile, file); diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/atomicoperations/OAtomicOperationBinaryTracking.java b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/atomicoperations/OAtomicOperationBinaryTracking.java index 8ae3587488b..43f6785f146 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/atomicoperations/OAtomicOperationBinaryTracking.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/atomicoperations/OAtomicOperationBinaryTracking.java @@ -200,7 +200,9 @@ public OAtomicOperationMetadata getMetadata(final String key) { return metadata.get(key); } - /** @return All keys and associated metadata contained inside of atomic operation */ + /** + * @return All keys and associated metadata contained inside of atomic operation + */ private Map> getMetadata() { return Collections.unmodifiableMap(metadata); } @@ -448,8 +450,9 @@ public OLogSequenceNumber commitChanges(final OWriteAheadLog writeAheadLog) thro OLogManager.instance() .warn( this, - "You performing truncate operation which is considered unsafe because can not be rolled back, " - + "as result data can be incorrectly restored after crash, this operation is not recommended to be used"); + "You performing truncate operation which is considered unsafe because can not be" + + " rolled back, as result data can be incorrectly restored after crash, this" + + " operation is not recommended to be used"); } final Iterator> filePageChangesIterator = @@ -501,8 +504,9 @@ public OLogSequenceNumber commitChanges(final OWriteAheadLog writeAheadLog) thro OLogManager.instance() .warn( this, - "You performing truncate operation which is considered unsafe because can not be rolled back, " - + "as result data can be incorrectly restored after crash, this operation is not recommended to be used"); + "You performing truncate operation which is considered unsafe because can not be" + + " rolled back, as result data can be incorrectly restored after crash, this" + + " operation is not recommended to be used"); readCache.truncateFile(fileId, writeCache); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/atomicoperations/OAtomicOperationMetadata.java b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/atomicoperations/OAtomicOperationMetadata.java index fdfa7bdb35b..eb70675d958 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/atomicoperations/OAtomicOperationMetadata.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/atomicoperations/OAtomicOperationMetadata.java @@ -25,9 +25,13 @@ */ @SuppressWarnings("SameReturnValue") public interface OAtomicOperationMetadata extends Serializable { - /** @return Key associated with given metadata */ + /** + * @return Key associated with given metadata + */ String getKey(); - /** @return Metadata value. */ + /** + * @return Metadata value. + */ T getValue(); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/atomicoperations/operationsfreezer/WaitingListNode.java b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/atomicoperations/operationsfreezer/WaitingListNode.java index a595a4f7028..c18da838ead 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/atomicoperations/operationsfreezer/WaitingListNode.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/atomicoperations/operationsfreezer/WaitingListNode.java @@ -21,7 +21,8 @@ void waitTillAllLinksWillBeCreated() { } catch (InterruptedException e) { throw OException.wrapException( new OInterruptedException( - "Thread was interrupted while was waiting for completion of 'waiting linked list' operation"), + "Thread was interrupted while was waiting for completion of 'waiting linked list'" + + " operation"), e); } } diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/base/ODurablePage.java b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/base/ODurablePage.java index b25cf95abe2..6393b142578 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/base/ODurablePage.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/base/ODurablePage.java @@ -66,15 +66,17 @@ public class ODurablePage { private final OWALChanges changes; private final OCacheEntry cacheEntry; - private final OCachePointer pointer; private final ByteBuffer buffer; public ODurablePage(final OCacheEntry cacheEntry) { assert cacheEntry != null; this.cacheEntry = cacheEntry; - this.pointer = cacheEntry.getCachePointer(); + OCachePointer pointer = cacheEntry.getCachePointer(); this.changes = cacheEntry.getChanges(); - this.buffer = pointer.getBufferDuplicate(); + this.buffer = pointer.getBuffer(); + + assert buffer == null || buffer.position() == 0; + assert buffer == null || buffer.isDirect(); if (cacheEntry.getInitialLSN() == null) { final ByteBuffer buffer = pointer.getBuffer(); @@ -106,23 +108,6 @@ public static OLogSequenceNumber getLogSequenceNumberFromPage(final ByteBuffer b return new OLogSequenceNumber(segment, position); } - /** - * DO NOT DELETE THIS METHOD IT IS USED IN ENTERPRISE STORAGE - * - *

    Copies content of page into passed in byte array. - * - * @param buffer Buffer from which data will be copied - * @param data Byte array to which data will be copied - * @param offset Offset of data inside page - * @param length Length of data to be copied - */ - @SuppressWarnings("unused") - public static void getPageData( - final ByteBuffer buffer, final byte[] data, final int offset, final int length) { - buffer.position(0); - buffer.get(data, offset, length); - } - /** * DO NOT DELETE THIS METHOD IT IS USED IN ENTERPRISE STORAGE * @@ -200,8 +185,7 @@ protected final byte[] getBinaryValue(final int pageOffset, final int valLen) { assert buffer.order() == ByteOrder.nativeOrder(); final byte[] result = new byte[valLen]; - buffer.position(pageOffset); - buffer.get(result); + buffer.get(pageOffset, result); return result; } @@ -215,8 +199,7 @@ protected int getObjectSizeInDirectMemory( assert buffer != null; assert buffer.order() == ByteOrder.nativeOrder(); - buffer.position(offset); - return binarySerializer.getObjectSizeInByteBuffer(buffer); + return binarySerializer.getObjectSizeInByteBuffer(offset, buffer); } return binarySerializer.getObjectSizeInByteBuffer(buffer, changes, offset); @@ -227,8 +210,8 @@ protected T deserializeFromDirectMemory( if (changes == null) { assert buffer != null; assert buffer.order() == ByteOrder.nativeOrder(); - buffer.position(offset); - return binarySerializer.deserializeFromByteBufferObject(buffer); + + return binarySerializer.deserializeFromByteBufferObject(offset, buffer); } return binarySerializer.deserializeFromByteBufferObject(buffer, changes, offset); } @@ -246,7 +229,6 @@ protected final byte getByteValue(final int pageOffset) { @SuppressWarnings("SameReturnValue") protected final int setIntValue(final int pageOffset, final int value) { - if (changes != null) { changes.setIntValue(buffer, value, pageOffset); } else { @@ -307,8 +289,7 @@ protected final int setBinaryValue(final int pageOffset, final byte[] value) { } else { assert buffer != null; assert buffer.order() == ByteOrder.nativeOrder(); - buffer.position(pageOffset); - buffer.put(value); + buffer.put(pageOffset, value); } return value.length; @@ -324,12 +305,8 @@ protected final void moveData(final int from, final int to, final int len) { } else { assert buffer != null; assert buffer.order() == ByteOrder.nativeOrder(); - final ByteBuffer rb = buffer.asReadOnlyBuffer(); - rb.position(from); - rb.limit(from + len); - buffer.position(to); - buffer.put(rb); + buffer.put(to, buffer, from, len); } } @@ -345,7 +322,6 @@ public void restoreChanges(final OWALChanges changes) { final ByteBuffer buffer = cacheEntry.getCachePointer().getBuffer(); assert buffer != null; - buffer.position(0); changes.applyChanges(buffer); } @@ -358,16 +334,6 @@ public final void setLsn(final OLogSequenceNumber lsn) { buffer.putInt(WAL_POSITION_OFFSET, lsn.getPosition()); } - public static void setPageLSN(final OLogSequenceNumber lsn, final OCacheEntry cacheEntry) { - final ByteBuffer buffer = cacheEntry.getCachePointer().getBufferDuplicate(); - assert buffer != null; - - assert buffer.order() == ByteOrder.nativeOrder(); - - buffer.putLong(WAL_SEGMENT_OFFSET, lsn.getSegment()); - buffer.putInt(WAL_POSITION_OFFSET, lsn.getPosition()); - } - @Override public String toString() { if (cacheEntry != null) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OPaginatedClusterFactory.java b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OPaginatedClusterFactory.java index 34741b85ae8..d7ae319bad0 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OPaginatedClusterFactory.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OPaginatedClusterFactory.java @@ -39,8 +39,8 @@ public static OPaginatedCluster createCluster( final OAbstractPaginatedStorage storage) { if (configurationVersion >= 0 && configurationVersion < 6) { throw new OStorageException( - "You use deprecated version of storage cluster, " - + "this version is not supported in current implementation. Please do export/import or recreate database."); + "You use deprecated version of storage cluster, this version is not supported in current" + + " implementation. Please do export/import or recreate database."); } switch (binaryVersion) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OWALChangesTree.java b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OWALChangesTree.java deleted file mode 100755 index 1b0c66343a0..00000000000 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OWALChangesTree.java +++ /dev/null @@ -1,774 +0,0 @@ -package com.orientechnologies.orient.core.storage.impl.local.paginated.wal; - -import com.orientechnologies.common.serialization.types.OByteSerializer; -import com.orientechnologies.common.serialization.types.OIntegerSerializer; -import com.orientechnologies.common.serialization.types.OLongSerializer; -import com.orientechnologies.common.serialization.types.OShortSerializer; -import com.orientechnologies.common.types.OModifiableInteger; -import java.nio.ByteBuffer; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Queue; - -public class OWALChangesTree implements OWALChanges { - private static final boolean BLACK = false; - private static final boolean RED = true; - - private Node root = null; - private int version = 0; - - private boolean debug; - - private int serializedSize = OIntegerSerializer.INT_SIZE; - - public void setDebug(boolean debug) { - this.debug = debug; - } - - @Override - public byte getByteValue(ByteBuffer buffer, int offset) { - if (root == null && buffer != null) { - return buffer.get(offset); - } - - final int end = offset + OByteSerializer.BYTE_SIZE; - final List result = new ArrayList<>(); - findIntervals(root, offset, end, result); - - if (buffer != null && result.isEmpty()) return buffer.get(offset); - - byte[] value = new byte[] {0}; - applyChanges(value, offset, end, result); - - return value[0]; - } - - @Override - public byte[] getBinaryValue(ByteBuffer buffer, int offset, int len) { - if (root == null && buffer != null) { - final byte[] value = new byte[len]; - buffer.position(offset); - buffer.get(value); - } - - final int end = offset + len; - - final List result = new ArrayList<>(); - findIntervals(root, offset, end, result); - - if (result.isEmpty() && buffer != null) { - final byte[] value = new byte[len]; - buffer.position(offset); - buffer.get(value); - } - - byte[] value; - - if (buffer != null) { - value = new byte[len]; - buffer.position(offset); - buffer.get(value); - } else value = new byte[len]; - - applyChanges(value, offset, end, result); - - return value; - } - - @Override - public short getShortValue(ByteBuffer buffer, int offset) { - if (root == null && buffer != null) { - return buffer.getShort(offset); - } - int end = offset + OShortSerializer.SHORT_SIZE; - - final List result = new ArrayList<>(); - findIntervals(root, offset, end, result); - - if (result.isEmpty() && buffer != null) return buffer.getShort(offset); - - byte[] value; - if (buffer != null) { - value = new byte[OShortSerializer.SHORT_SIZE]; - buffer.position(offset); - buffer.get(value); - } else value = new byte[OShortSerializer.SHORT_SIZE]; - - applyChanges(value, offset, end, result); - - return OShortSerializer.INSTANCE.deserializeNative(value, 0); - } - - @Override - public int getIntValue(ByteBuffer buffer, int offset) { - if (root == null && buffer != null) { - return buffer.getInt(offset); - } - int end = offset + OIntegerSerializer.INT_SIZE; - - final List result = new ArrayList<>(); - findIntervals(root, offset, end, result); - - if (result.isEmpty() && buffer != null) return buffer.getInt(offset); - - byte[] value; - if (buffer != null) { - value = new byte[OIntegerSerializer.INT_SIZE]; - buffer.position(offset); - buffer.get(value); - } else value = new byte[OIntegerSerializer.INT_SIZE]; - - applyChanges(value, offset, end, result); - - return OIntegerSerializer.INSTANCE.deserializeNative(value, 0); - } - - @Override - public long getLongValue(ByteBuffer buffer, int offset) { - if (root == null && buffer != null) { - return buffer.getLong(offset); - } - int end = offset + OLongSerializer.LONG_SIZE; - - final List result = new ArrayList<>(); - findIntervals(root, offset, end, result); - - if (result.isEmpty() && buffer != null) return buffer.getLong(offset); - - byte[] value; - if (buffer != null) { - value = new byte[OLongSerializer.LONG_SIZE]; - buffer.position(offset); - buffer.get(value); - } else value = new byte[OLongSerializer.LONG_SIZE]; - - applyChanges(value, offset, end, result); - - return OLongSerializer.INSTANCE.deserializeNative(value, 0); - } - - @Override - public void setIntValue(ByteBuffer buffer, int value, int offset) { - byte[] sValue = new byte[OIntegerSerializer.INT_SIZE]; - OIntegerSerializer.INSTANCE.serializeNative(value, sValue, 0); - add(sValue, offset); - } - - @Override - public void setShortValue(ByteBuffer buffer, short value, int offset) {} - - @Override - public void setLongValue(ByteBuffer buffer, long value, int offset) { - byte[] sValue = new byte[OLongSerializer.LONG_SIZE]; - OLongSerializer.INSTANCE.serializeNative(value, sValue, 0); - add(sValue, offset); - } - - @Override - public void moveData(ByteBuffer buffer, int from, int to, int len) { - byte[] content = getBinaryValue(buffer, from, len); - add(content, to); - } - - @Override - public void setBinaryValue(ByteBuffer buffer, byte[] value, int offset) { - add(value, offset); - } - - @Override - public void setByteValue(ByteBuffer buffer, byte value, int offset) { - add(new byte[] {value}, offset); - } - - @Override - public void fromStream(ByteBuffer buffer) { - throw new UnsupportedOperationException(); - } - - public void add(byte[] value, int start) { - version++; - - add(value, start, version, true); - } - - private void add(byte[] value, int start, int version, boolean updateSerializedSize) { - if (value == null || value.length == 0) return; - - final Node fNode = binarySearch(start); - - final Node node = new Node(value, start, RED, version); - - if (fNode == null) { - root = node; - root.color = BLACK; - - if (debug) assertInvariants(); - - if (updateSerializedSize) serializedSize += serializedSize(value.length); - - return; - } - - if (start < fNode.start) { - fNode.left = node; - node.parent = fNode; - - if (updateSerializedSize) serializedSize += serializedSize(value.length); - - updateMaxEndAfterAppend(node); - insertCaseOne(node); - } else if (start > fNode.start) { - fNode.right = node; - node.parent = fNode; - - if (updateSerializedSize) serializedSize += serializedSize(value.length); - - updateMaxEndAfterAppend(node); - insertCaseOne(node); - } else { - final int end = start + value.length; - if (end == fNode.end) { - if (fNode.version < version) { - if (updateSerializedSize) serializedSize -= fNode.value.length; - - fNode.value = value; - fNode.version = version; - - if (updateSerializedSize) serializedSize += fNode.value.length; - } - } else if (end < fNode.end) { - if (fNode.version < version) { - final byte[] cValue = Arrays.copyOfRange(fNode.value, end - start, fNode.end - start); - final int cVersion = fNode.version; - final int cStart = end; - - if (updateSerializedSize) serializedSize -= fNode.value.length; - - fNode.end = end; - fNode.value = value; - fNode.version = version; - - if (updateSerializedSize) serializedSize += fNode.value.length; - - updateMaxEndAccordingToChildren(fNode); - - add(cValue, cStart, cVersion, updateSerializedSize); - } - } else { - if (fNode.version > version) { - final byte[] cValue = Arrays.copyOfRange(value, fNode.end - start, end - start); - final int cVersion = version; - final int cStart = fNode.end; - - add(cValue, cStart, cVersion, updateSerializedSize); - } else { - if (updateSerializedSize) serializedSize -= fNode.value.length; - - fNode.end = end; - fNode.value = value; - fNode.version = version; - - if (updateSerializedSize) serializedSize += fNode.value.length; - - updateMaxEndAccordingToChildren(fNode); - } - } - } - - if (debug) assertInvariants(); - } - - public void applyChanges(byte[] values, int start) { - final int end = start + values.length; - final List result = new ArrayList<>(); - findIntervals(root, start, end, result); - - applyChanges(values, start, end, result); - } - - @Override - public int serializedSize() { - return serializedSize; - } - - public int serializedSize(int content) { - return content + 3 * OIntegerSerializer.INT_SIZE; // start, version, content size + content - } - - private void applyChanges(byte[] values, int start, int end, List result) { - if (result.isEmpty()) return; - - final Queue processedNodes = new ArrayDeque<>(); - - for (Node activeNode : result) { - int activeStart = activeNode.start; - - final Iterator pNodesIterator = processedNodes.iterator(); - while (pNodesIterator.hasNext()) { - final Node pNode = pNodesIterator.next(); - if (pNode.end > activeStart && pNode.version > activeNode.version) activeStart = pNode.end; - - if (pNode.end <= activeNode.start) pNodesIterator.remove(); - } - - processedNodes.add(activeNode); - - if (activeStart >= activeNode.end) continue; - - final int deltaStart = activeStart - start; - - final int vStart; - if (deltaStart > 0) vStart = start + deltaStart; - else vStart = start; - - int vLength; - if (deltaStart > 0) vLength = (activeNode.end - activeStart); - else vLength = (activeNode.end - activeStart) + deltaStart; - - final int vEnd = vLength + vStart; - if (vEnd > end) vLength = vLength - (vEnd - end); - - if (vLength <= 0) continue; - - System.arraycopy( - activeNode.value, - deltaStart >= 0 - ? activeStart - activeNode.start - : activeStart - activeNode.start - deltaStart, - values, - deltaStart >= 0 ? deltaStart : 0, - vLength); - } - } - - @Override - public void applyChanges(ByteBuffer buffer) { - if (root == null) return; - - final Queue processedNodes = new ArrayDeque<>(); - applyChanges(buffer, root, processedNodes); - } - - public int getSerializedSize() { - return serializedSize; - } - - @Override - public int fromStream(int offset, byte[] stream) { - serializedSize = OIntegerSerializer.INSTANCE.deserializeNative(stream, offset); - int readBytes = OIntegerSerializer.INT_SIZE; - - while (readBytes < serializedSize) { - int start = OIntegerSerializer.INSTANCE.deserializeNative(stream, offset + readBytes); - readBytes += OIntegerSerializer.INT_SIZE; - - int version = OIntegerSerializer.INSTANCE.deserializeNative(stream, offset + readBytes); - readBytes += OIntegerSerializer.INT_SIZE; - - int length = OIntegerSerializer.INSTANCE.deserializeNative(stream, offset + readBytes); - readBytes += OIntegerSerializer.INT_SIZE; - - byte[] data = new byte[length]; - System.arraycopy(stream, offset + readBytes, data, 0, length); - - readBytes += length; - - add(data, start, version, false); - } - - return offset + readBytes; - } - - @Override - public int toStream(int offset, byte[] stream) { - OIntegerSerializer.INSTANCE.serializeNative(serializedSize, stream, offset); - offset += OIntegerSerializer.INT_SIZE; - if (root == null) return offset; - - offset = toStream(root, offset, stream); - - return offset; - } - - private int toStream(Node node, int offset, byte[] stream) { - if (node.left != null) offset = toStream(node.left, offset, stream); - - OIntegerSerializer.INSTANCE.serializeNative(node.start, stream, offset); - offset += OIntegerSerializer.INT_SIZE; - - OIntegerSerializer.INSTANCE.serializeNative(node.version, stream, offset); - offset += OIntegerSerializer.INT_SIZE; - - OIntegerSerializer.INSTANCE.serializeNative(node.value.length, stream, offset); - offset += OIntegerSerializer.INT_SIZE; - - System.arraycopy(node.value, 0, stream, offset, node.value.length); - offset += node.value.length; - - if (node.right != null) offset = toStream(node.right, offset, stream); - - return offset; - } - - private void applyChanges(ByteBuffer buffer, Node node, Queue processedNodes) { - if (node.left != null) applyChanges(buffer, node.left, processedNodes); - - int activeStart = node.start; - - final Iterator pNodesIterator = processedNodes.iterator(); - while (pNodesIterator.hasNext()) { - final Node pNode = pNodesIterator.next(); - if (pNode.end > activeStart && pNode.version > node.version) activeStart = pNode.end; - - if (pNode.end <= node.start) pNodesIterator.remove(); - } - - processedNodes.add(node); - - if (activeStart < node.end) { - final int vLength = node.end - activeStart; - buffer.position(activeStart); - buffer.put(node.value, activeStart - node.start, vLength); - } - - if (node.right != null) applyChanges(buffer, node.right, processedNodes); - } - - private void assertInvariants() { - assert rootIsBlack(); - assert redHaveBlackChildNodes(); - assert allBlackPathsAreEqual(); - assert maxEndIsPresent(); - assert maxEndValueIsCorrect(); - } - - private boolean allBlackPathsAreEqual() { - List paths = new ArrayList<>(); - OModifiableInteger currentPath = new OModifiableInteger(); - paths.add(currentPath); - - calculateBlackPathsFromNode(root, paths, currentPath); - - final int basePath = paths.get(0).getValue(); - for (OModifiableInteger path : paths) { - if (path.getValue() != basePath) return false; - } - - return true; - } - - private void calculateBlackPathsFromNode( - Node node, List paths, OModifiableInteger currentPath) { - if (node.color == BLACK) { - currentPath.increment(); - } - - if (node.right != null) { - OModifiableInteger newPath = new OModifiableInteger(currentPath.getValue()); - paths.add(newPath); - - calculateBlackPathsFromNode(node.right, paths, newPath); - } - - if (node.left != null) { - calculateBlackPathsFromNode(node.left, paths, currentPath); - } - } - - private boolean redHaveBlackChildNodes() { - return redHaveBlackChildNodes(root); - } - - private boolean redHaveBlackChildNodes(Node node) { - if (node.color == RED) { - if (node.left != null && node.left.color == RED) return false; - - if (node.right != null && node.right.color == RED) return false; - } - - if (node.left != null && !redHaveBlackChildNodes(node.left)) return false; - - if (node.right != null && !redHaveBlackChildNodes(node.right)) return false; - - return true; - } - - private boolean rootIsBlack() { - if (root == null) return true; - - return root.color == BLACK; - } - - private boolean maxEndIsPresent() { - if (root == null) return true; - - return maxEndIsPresent(root); - } - - private boolean maxEndIsPresent(Node node) { - boolean result = endValueIsPresentAmongChildren(node.maxEnd, node); - if (!result) return false; - - if (node.left != null) result = maxEndIsPresent(node.left); - - if (!result) return false; - - if (node.right != null) result = maxEndIsPresent(node.right); - - return result; - } - - private boolean endValueIsPresentAmongChildren(int value, Node node) { - if (node.end == value) return true; - - if (node.left != null && endValueIsPresentAmongChildren(value, node.left)) return true; - - if (node.right != null && endValueIsPresentAmongChildren(value, node.right)) return true; - - return false; - } - - private boolean maxEndValueIsCorrect() { - if (root == null) return true; - - return maxEndValueIsCorrect(root); - } - - private boolean maxEndValueIsCorrect(Node node) { - if (!valueIsMaxEndValueAmongChildren(node, node.maxEnd)) return false; - - if (node.left != null && !maxEndIsPresent(node.left)) return false; - - if (node.right != null && !maxEndIsPresent(node.right)) return false; - - return true; - } - - @SuppressWarnings("BooleanMethodIsAlwaysInverted") - private boolean valueIsMaxEndValueAmongChildren(Node node, int value) { - if (node.end > value) return false; - - if (node.left != null && !valueIsMaxEndValueAmongChildren(node.left, value)) return false; - - if (node.right != null && !valueIsMaxEndValueAmongChildren(node.right, value)) return false; - - return true; - } - - private void findIntervals(Node node, int start, int end, List result) { - if (node == null) return; - - if (start >= node.maxEnd) return; - - if (node.left != null) findIntervals(node.left, start, end, result); - - if (node.overlapsWith(start, end)) result.add(node); - - if (end <= node.start) return; - - if (node.right != null) findIntervals(node.right, start, end, result); - } - - private Node binarySearch(int start) { - if (root == null) return null; - - Node current = root; - - while (true) { - if (start < current.start) { - if (current.left != null) current = current.left; - else return current; - } else if (start > current.start) { - if (current.right != null) current = current.right; - else return current; - } else return current; - } - } - - private void insertCaseOne(Node node) { - if (node.parent == null) { - node.color = BLACK; - } else { - insertCaseTwo(node); - } - } - - private void insertCaseTwo(Node node) { - if (node.parent.color == BLACK) { - return; - } - - insertCaseThree(node); - } - - private void insertCaseThree(Node node) { - Node u = uncle(node); - if (u != null && u.color == RED) { - node.parent.color = BLACK; - u.color = BLACK; - - Node g = grandparent(node); - g.color = RED; - - insertCaseOne(g); - } else { - insertCaseFour(node); - } - } - - private void insertCaseFour(Node node) { - Node g = grandparent(node); - if (node == node.parent.right && node.parent == g.left) { - rotateLeft(node.parent); - - node = node.left; - } else if (node == node.parent.left && node.parent == g.right) { - rotateRight(node.parent); - - node = node.right; - } - - insertCaseFive(node); - } - - private void rotateRight(Node node) { - Node q = node; - Node p = q.left; - Node b = p.right; - - Node parent = node.parent; - - p.right = q; - q.parent = p; - - p.parent = parent; - - if (parent != null) { - if (parent.left == node) parent.left = p; - else parent.right = p; - } - - q.left = b; - if (b != null) b.parent = q; - - if (node == root) root = p; - - updateMaxEndAccordingToChildren(q); - } - - private void rotateLeft(Node node) { - Node p = node; - Node q = p.right; - Node b = q.left; - - Node parent = node.parent; - - q.left = p; - p.parent = q; - - q.parent = parent; - if (parent != null) { - if (parent.left == node) parent.left = q; - else parent.right = q; - } - - p.right = b; - - if (b != null) b.parent = p; - - if (node == root) root = q; - - updateMaxEndAccordingToChildren(p); - } - - private void updateMaxEndAccordingToChildren(Node node) { - if (node.left != null && node.right != null) { - node.maxEnd = Math.max(node.end, Math.max(node.left.maxEnd, node.right.maxEnd)); - } else if (node.left != null) { - node.maxEnd = Math.max(node.end, node.left.maxEnd); - } else if (node.right != null) { - node.maxEnd = Math.max(node.end, node.right.maxEnd); - } else { - node.maxEnd = node.end; - } - - if (node.parent != null) updateMaxEndAccordingToChildren(node.parent); - } - - private void insertCaseFive(Node node) { - Node g = grandparent(node); - - node.parent.color = BLACK; - g.color = RED; - - if (node == node.parent.left) rotateRight(g); - else rotateLeft(g); - } - - private Node grandparent(Node node) { - if (node != null && node.parent != null) { - return node.parent.parent; - } - - return null; - } - - private Node uncle(Node node) { - Node g = grandparent(node); - - if (g == null) return null; - - if (node.parent == g.left) return g.right; - - return g.left; - } - - private void updateMaxEndAfterAppend(Node node) { - final Node parent = node.parent; - if (parent != null && parent.maxEnd < node.maxEnd) { - parent.maxEnd = node.maxEnd; - updateMaxEndAfterAppend(parent); - } - } - - private static final class Node { - private boolean color; - private byte[] value; - private int version; - - private final int start; - private int end; - private int maxEnd; - - private Node parent; - private Node left; - private Node right; - - public Node(byte[] value, int start, boolean color, int version) { - this.color = color; - this.version = version; - - this.value = value; - this.start = start; - this.end = start + value.length; - this.maxEnd = end; - } - - private boolean overlapsWith(int start, int end) { - return this.start < end && this.end > start; - } - } - - @Override - public boolean hasChanges() { - return root != null; - } - - @Override - public void toStream(ByteBuffer byteBuffer) { - throw new UnsupportedOperationException(); - } -} diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OWALPage.java b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OWALPage.java index 3871787665d..de2c22a4321 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OWALPage.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OWALPage.java @@ -43,6 +43,8 @@ public interface OWALPage { */ boolean mergeWithNextPage(int position); - /** @return Amount of free space available to store new records inside of page. */ + /** + * @return Amount of free space available to store new records inside of page. + */ int getFreeSpace(); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OWALPageChangesPortion.java b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OWALPageChangesPortion.java index 832185b9d09..a8787d38ff0 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OWALPageChangesPortion.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OWALPageChangesPortion.java @@ -12,13 +12,14 @@ * @author Andrey Lomakin (a.lomakin-at-orientdb.com) . * @since 8/17/2015 */ -public class OWALPageChangesPortion implements OWALChanges { +public final class OWALPageChangesPortion implements OWALChanges { + private static final int PAGE_SIZE = OGlobalConfiguration.DISK_CACHE_PAGE_SIZE.getValueAsInteger() * 1024; private static final int CHUNK_SIZE = 32; private static final int PORTION_SIZE = 32; - static final int PORTION_BYTES = PORTION_SIZE * CHUNK_SIZE; + public static final int PORTION_BYTES = PORTION_SIZE * CHUNK_SIZE; private byte[][][] pageChunks; @@ -125,14 +126,15 @@ public byte[] getBinaryValue(ByteBuffer pointer, int offset, int len) { @Override public void applyChanges(ByteBuffer pointer) { - if (pageChunks == null) return; + if (pageChunks == null) { + return; + } for (int i = 0; i < pageChunks.length; i++) { if (pageChunks[i] != null) { for (int j = 0; j < PORTION_SIZE; j++) { byte[] chunk = pageChunks[i][j]; if (chunk != null) { - pointer.position(i * PORTION_BYTES + j * CHUNK_SIZE); - pointer.put(chunk, 0, chunk.length); + pointer.put(i * PORTION_BYTES + j * CHUNK_SIZE, chunk, 0, chunk.length); } } } @@ -279,8 +281,7 @@ public void fromStream(ByteBuffer buffer) { private void readData(ByteBuffer pointer, int offset, byte[] data) { if (pageChunks == null) { if (pointer != null) { - pointer.position(offset); - pointer.get(data, 0, data.length); + pointer.get(offset, data, 0, data.length); } return; } @@ -289,8 +290,7 @@ private void readData(ByteBuffer pointer, int offset, byte[] data) { if (portionIndex == (offset + data.length - 1) / PORTION_BYTES && pageChunks[portionIndex] == null) { if (pointer != null) { - pointer.position(offset); - pointer.get(data, 0, data.length); + pointer.get(offset, data, 0, data.length); } return; } @@ -302,15 +302,17 @@ private void readData(ByteBuffer pointer, int offset, byte[] data) { while (read < data.length) { byte[] chunk = null; - if (pageChunks[portionIndex] != null) chunk = pageChunks[portionIndex][chunkIndex]; + if (pageChunks[portionIndex] != null) { + chunk = pageChunks[portionIndex][chunkIndex]; + } final int rl = Math.min(CHUNK_SIZE - chunkOffset, data.length - read); if (chunk == null) { if (pointer != null) { - pointer.position(portionIndex * PORTION_BYTES + (chunkIndex * CHUNK_SIZE) + chunkOffset); - pointer.get(data, read, rl); + var position = portionIndex * PORTION_BYTES + (chunkIndex * CHUNK_SIZE) + chunkOffset; + pointer.get(position, data, read, rl); } - } else + } else { try { System.arraycopy(chunk, chunkOffset, data, read, rl); } catch (Exception e) { @@ -330,6 +332,7 @@ private void readData(ByteBuffer pointer, int offset, byte[] data) { e); throw e; } + } read += rl; chunkOffset = 0; @@ -368,8 +371,8 @@ private void updateData(ByteBuffer pointer, int offset, byte[] data) { // pointer can be null for new pages if (pointer != null) { - pointer.position(portionIndex * PORTION_BYTES + chunkIndex * CHUNK_SIZE); - pointer.get(chunk); + var position = portionIndex * PORTION_BYTES + chunkIndex * CHUNK_SIZE; + pointer.get(position, chunk); } pageChunks[portionIndex][chunkIndex] = chunk; diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OWALPageV1.java b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OWALPageV1.java deleted file mode 100755 index dfdf4536e0b..00000000000 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OWALPageV1.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.orientechnologies.orient.core.storage.impl.local.paginated.wal; - -import com.orientechnologies.common.serialization.types.OIntegerSerializer; -import java.nio.ByteBuffer; - -/** - * WAL page is organized using following format: - * - *

    - * - *

      - *
    1. CRC32 code of page content, it is used to check whether data are broken on disk. 4 bytes - *
    2. Magic number, randomly generated number which is used to check whether page is broken on - * disk. 8 bytes - *
    3. Amount of free space left on page, which can be used to add new records, 4 bytes - *
    4. WAL records - *
    - * - *

    Each WAL record is stored using following format: - * - *

      - *
    1. Flag which indicates that record should be merged with record which is stored on next page. - * That is needed if record can not be stored on one page and is split by two pages. 1 byte - *
    2. Flag which indicates that this record is actually tail of long record parts of which are - * stored on other pages, 1 byte - *
    3. Length of serialized content of WAL record. 4 bytes - *
    4. Serialized content of the WAL record. Variable size. - *
    - * - *

    - * - *

    Every time new record is added. Value of free space left on page is updated. - * - * @author Andrey Lomakin - * @since 5/8/13 - */ -public class OWALPageV1 implements OWALPage { - /** - * Value of magic number for v1 version of binary format - * - * @see OWALPage#MAGIC_NUMBER_OFFSET - */ - static final long MAGIC_NUMBER = 0xFACB03FEL; - - /** - * Offset inside of the page starting from which we will store new records till the end of the - * page. - */ - static final int RECORDS_OFFSET = FREE_SPACE_OFFSET + OIntegerSerializer.INT_SIZE; - - /** - * Maximum size of the records which can be stored inside of the page - * - * @see #calculateRecordSize(int) - * @see #calculateSerializedSize(int) - */ - static final int MAX_ENTRY_SIZE = PAGE_SIZE - RECORDS_OFFSET; - - private final ByteBuffer buffer; - - OWALPageV1(ByteBuffer buffer, boolean isNew) { - this.buffer = buffer; - - if (isNew) { - buffer.position(MAGIC_NUMBER_OFFSET); - - buffer.putLong(MAGIC_NUMBER); - buffer.putInt(MAX_ENTRY_SIZE); - } - } - - /** {@inheritDoc} */ - @Override - public byte[] getRecord(int position) { - buffer.position(position + 2); - final int recordSize = buffer.getInt(); - final byte[] record = new byte[recordSize]; - buffer.get(record); - return record; - } - - /** {@inheritDoc} */ - @Override - public boolean mergeWithNextPage(int position) { - return buffer.get(position) > 0; - } - - /** {@inheritDoc} */ - @Override - public int getFreeSpace() { - return buffer.getInt(FREE_SPACE_OFFSET); - } - - /** - * Calculates how much space record will consume once it will be stored inside of page. Sizes are - * different because once record is stored inside of the page, it is wrapped by additional system - * information. - */ - static int calculateSerializedSize(int recordSize) { - return recordSize + OIntegerSerializer.INT_SIZE + 2; - } - - /** - * Calculates how much space record stored inside of page will consume once it will be read from - * page. In other words it calculates initial size of the record before it was stored inside of - * the page. Sizes are different because once record is stored inside of the page, it is wrapped - * by additional system information. - */ - static int calculateRecordSize(int serializedSize) { - return serializedSize - OIntegerSerializer.INT_SIZE - 2; - } -} diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OWALPageV2.java b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OWALPageV2.java deleted file mode 100755 index 6b4f7408c5d..00000000000 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/OWALPageV2.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright 2010-2013 OrientDB LTD (info--at--orientdb.com) - * - * 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 com.orientechnologies.orient.core.storage.impl.local.paginated.wal; - -import com.orientechnologies.common.serialization.types.OIntegerSerializer; -import com.orientechnologies.common.serialization.types.OLongSerializer; -import java.nio.ByteBuffer; - -/** - * WAL page is organized using following format: - * - *

    - * - *

      - *
    1. CRC32 code of page content, it is used to check whether data are broken on disk. 4 bytes - *
    2. Magic number, randomly generated number which is used to check whether page is broken on - * disk. 8 bytes - *
    3. Amount of free space left on page, which can be used to add new records, 4 bytes - *
    4. Position of LSN of last record which end is stored on this page, 8 bytes - *
    5. End of the last record stored in page, 4 bytes - *
    6. WAL records - *
    - * - *

    Each WAL record is stored using following format: - * - *

      - *
    1. Flag which indicates that record should be merged with record which is stored on next page. - * That is needed if record can not be stored on one page and is split by two pages. 1 byte - *
    2. Flag which indicates that this record is actually tail of long record parts of which are - * stored on other pages, 1 byte - *
    3. Length of serialized content of WAL record. 4 bytes - *
    4. Serialized content of the WAL record. Variable size. - *
    - * - *

    - * - *

    Every time new record is added. Value of free space left on page is updated. - * - * @author Andrey Lomakin - * @since 5/8/13 - */ -public class OWALPageV2 implements OWALPage { - /** - * Value of magic number for v2 version of binary format - * - * @see OWALPage#MAGIC_NUMBER_OFFSET - */ - static final long MAGIC_NUMBER = 0xEF30BCAFL; - - /** - * Information about position of LSN of last record which end is stored on this page. If only - * begging of the record is stored on this page its position is not stored. - * - * @see OLogSegmentV2.WriteTask#run() - * @see OLogSegmentV2#init() - */ - static final int LAST_STORED_LSN = FREE_SPACE_OFFSET + OIntegerSerializer.INT_SIZE; - - /** - * End of the last record stored in page. This value is used in case of end of the WAL is broken - * and we want to truncate it to read only valid values - * - * @see OLogSegmentV2.WriteTask#init() - * @see OLogSegmentV2#init() - */ - static final int END_LAST_RECORD = LAST_STORED_LSN + OLongSerializer.LONG_SIZE; - - /** - * Offset inside of the page starting from which we will store new records till the end of the - * page. - */ - static final int RECORDS_OFFSET = END_LAST_RECORD + OIntegerSerializer.INT_SIZE; - - /** - * Maximum size of the records which can be stored inside of the page - * - * @see #calculateRecordSize(int) - * @see #calculateSerializedSize(int) - */ - static final int MAX_ENTRY_SIZE = PAGE_SIZE - RECORDS_OFFSET; - - private final ByteBuffer buffer; - - OWALPageV2(ByteBuffer buffer, boolean isNew) { - this.buffer = buffer; - - if (isNew) { - buffer.position(MAGIC_NUMBER_OFFSET); - - buffer.putLong(MAGIC_NUMBER); - buffer.putInt(MAX_ENTRY_SIZE); - - buffer.putLong(-1); // -1 means that we do not store any log record on this page - buffer.putInt(-1); // -1 means that we do not store any log record on this page - } - } - - /** {@inheritDoc} */ - @Override - public byte[] getRecord(int position) { - buffer.position(position + 2); - final int recordSize = buffer.getInt(); - final byte[] record = new byte[recordSize]; - buffer.get(record); - return record; - } - - /** {@inheritDoc} */ - @Override - public boolean mergeWithNextPage(int position) { - return buffer.get(position) > 0; - } - - /** {@inheritDoc} */ - @Override - public int getFreeSpace() { - return buffer.getInt(FREE_SPACE_OFFSET); - } - - /** - * Calculates how much space record will consume once it will be stored inside of page. Sizes are - * different because once record is stored inside of the page, it is wrapped by additional system - * information. - */ - static int calculateSerializedSize(int recordSize) { - return recordSize + OIntegerSerializer.INT_SIZE + 2; - } - - /** - * Calculates how much space record stored inside of page will consume once it will be read from - * page. In other words it calculates initial size of the record before it was stored inside of - * the page. Sizes are different because once record is stored inside of the page, it is wrapped - * by additional system information. - */ - static int calculateRecordSize(int serializedSize) { - return serializedSize - OIntegerSerializer.INT_SIZE - 2; - } -} diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/cas/CASDiskWriteAheadLog.java b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/cas/CASDiskWriteAheadLog.java index 169229efd47..e92b6d1b42f 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/cas/CASDiskWriteAheadLog.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/wal/cas/CASDiskWriteAheadLog.java @@ -2110,8 +2110,8 @@ private void printReport() { OLogManager.instance() .infoNoDb( this, - "WAL stat:%s: %d KB was written, write speed is %d KB/s. FSync count %d. " - + "Avg. fsync time %d ms. %d times threads were waiting for WAL. Avg wait interval %d ms.", + "WAL stat:%s: %d KB was written, write speed is %d KB/s. FSync count %d. Avg. fsync" + + " time %d ms. %d times threads were waiting for WAL. Avg wait interval %d ms.", storageName, bytesWritten / 1024, writtenTime > 0 ? 1_000_000_000L * bytesWritten / writtenTime / 1024 : -1, diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/index/hashindex/local/OHashIndexFactory.java b/core/src/main/java/com/orientechnologies/orient/core/storage/index/hashindex/local/OHashIndexFactory.java index 61ea24c67d4..86f75e13f18 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/index/hashindex/local/OHashIndexFactory.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/index/hashindex/local/OHashIndexFactory.java @@ -39,7 +39,9 @@ import java.util.HashSet; import java.util.Set; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public final class OHashIndexFactory implements OIndexFactory { private static final Set TYPES; diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/OSBTreeMapEntryIterator.java b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/OSBTreeMapEntryIterator.java index 50ed5234879..0ad98ae7b07 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/OSBTreeMapEntryIterator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/OSBTreeMapEntryIterator.java @@ -32,7 +32,9 @@ import java.util.Map; import java.util.NoSuchElementException; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public class OSBTreeMapEntryIterator implements Iterator> { private LinkedList> preFetchedValues; private final OTreeInternal sbTree; diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/OTreeInternal.java b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/OTreeInternal.java index e6285825f5d..51273b4dbae 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/OTreeInternal.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/OTreeInternal.java @@ -26,7 +26,9 @@ import java.util.List; import java.util.Map; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public interface OTreeInternal { boolean isEmpty(); @@ -37,7 +39,9 @@ void loadEntriesMajor( V remove(OAtomicOperation atomicOperation, K key) throws IOException; - /** @author Artem Orobets (enisher-at-gmail.com) */ + /** + * @author Artem Orobets (enisher-at-gmail.com) + */ interface RangeResultListener { /** * Callback method for result entries. diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/local/v1/OSBTreeV1.java b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/local/v1/OSBTreeV1.java index cb507ef6baa..d0ed05a944f 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/local/v1/OSBTreeV1.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/local/v1/OSBTreeV1.java @@ -1338,7 +1338,8 @@ private BucketSearchResult findBucket(final K key, final OAtomicOperation atomic while (true) { if (path.size() > MAX_PATH_LENGTH) { throw new OSBTreeException( - "We reached max level of depth of SBTree but still found nothing, seems like tree is in corrupted state. You should rebuild index related to given query.", + "We reached max level of depth of SBTree but still found nothing, seems like tree is in" + + " corrupted state. You should rebuild index related to given query.", this); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/local/v2/OSBTreeV2.java b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/local/v2/OSBTreeV2.java index ff256746315..b8c345b9645 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/local/v2/OSBTreeV2.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/local/v2/OSBTreeV2.java @@ -1309,7 +1309,8 @@ private BucketSearchResult findBucket(final K key, final OAtomicOperation atomic while (true) { if (path.size() > MAX_PATH_LENGTH) { throw new OSBTreeException( - "We reached max level of depth of SBTree but still found nothing, seems like tree is in corrupted state. You should rebuild index related to given query.", + "We reached max level of depth of SBTree but still found nothing, seems like tree is in" + + " corrupted state. You should rebuild index related to given query.", this); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/multivalue/v2/CellBTreeMultiValueV2.java b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/multivalue/v2/CellBTreeMultiValueV2.java index eb9d71225ba..3505857f91c 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/multivalue/v2/CellBTreeMultiValueV2.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/multivalue/v2/CellBTreeMultiValueV2.java @@ -1646,7 +1646,8 @@ private BucketSearchResult findBucket(final K key, final OAtomicOperation atomic depth++; if (depth > MAX_PATH_LENGTH) { throw new CellBTreeMultiValueException( - "We reached max level of depth of SBTree but still found nothing, seems like tree is in corrupted state. You should rebuild index related to given query.", + "We reached max level of depth of SBTree but still found nothing, seems like tree is in" + + " corrupted state. You should rebuild index related to given query.", this); } @@ -1683,7 +1684,8 @@ private UpdateBucketSearchResult findBucketForUpdate( while (true) { if (path.size() > MAX_PATH_LENGTH) { throw new CellBTreeMultiValueException( - "We reached max level of depth of SBTree but still found nothing, seems like tree is in corrupted state. You should rebuild index related to given query.", + "We reached max level of depth of SBTree but still found nothing, seems like tree is in" + + " corrupted state. You should rebuild index related to given query.", this); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/multivalue/v2/MultiValueEntry.java b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/multivalue/v2/MultiValueEntry.java index 1710fce5b05..b60351fae06 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/multivalue/v2/MultiValueEntry.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/multivalue/v2/MultiValueEntry.java @@ -1,6 +1,6 @@ package com.orientechnologies.orient.core.storage.index.sbtree.multivalue.v2; -final class MultiValueEntry implements Comparable { +public final class MultiValueEntry implements Comparable { public final long id; public final int clusterId; public final long clusterPosition; diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/multivalue/v2/MultiValueEntrySerializer.java b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/multivalue/v2/MultiValueEntrySerializer.java index d6b959dd8bf..076563bbe36 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/multivalue/v2/MultiValueEntrySerializer.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/multivalue/v2/MultiValueEntrySerializer.java @@ -7,6 +7,7 @@ import java.nio.ByteBuffer; public final class MultiValueEntrySerializer implements OBinarySerializer { + public static final int ID = 27; public static final MultiValueEntrySerializer INSTANCE = new MultiValueEntrySerializer(); @@ -120,11 +121,29 @@ public MultiValueEntry deserializeFromByteBufferObject(final ByteBuffer buffer) return new MultiValueEntry(id, clusterId, clusterPosition); } + @Override + public MultiValueEntry deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + final long id = buffer.getLong(offset); + offset += Long.BYTES; + + final int clusterId = buffer.getShort(offset); + offset += Short.BYTES; + + final long clusterPosition = buffer.getLong(offset); + + return new MultiValueEntry(id, clusterId, clusterPosition); + } + @Override public int getObjectSizeInByteBuffer(final ByteBuffer buffer) { return 2 * OLongSerializer.LONG_SIZE + OShortSerializer.SHORT_SIZE; } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return 2 * OLongSerializer.LONG_SIZE + OShortSerializer.SHORT_SIZE; + } + @Override public MultiValueEntry deserializeFromByteBufferObject( final ByteBuffer buffer, final OWALChanges walChanges, final int offset) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/singlevalue/v1/CellBTreeSingleValueV1.java b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/singlevalue/v1/CellBTreeSingleValueV1.java index 66c13b32c8b..176bbbaba99 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/singlevalue/v1/CellBTreeSingleValueV1.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/singlevalue/v1/CellBTreeSingleValueV1.java @@ -1332,7 +1332,8 @@ private BucketSearchResult findBucket(final K key, final OAtomicOperation atomic depth++; if (depth > MAX_PATH_LENGTH) { throw new OCellBTreeSingleValueV1Exception( - "We reached max level of depth of SBTree but still found nothing, seems like tree is in corrupted state. You should rebuild index related to given query.", + "We reached max level of depth of SBTree but still found nothing, seems like tree is in" + + " corrupted state. You should rebuild index related to given query.", this); } @@ -1370,7 +1371,8 @@ private UpdateBucketSearchResult findBucketForUpdate( while (true) { if (path.size() > MAX_PATH_LENGTH) { throw new OCellBTreeSingleValueV1Exception( - "We reached max level of depth of SBTree but still found nothing, seems like tree is in corrupted state. You should rebuild index related to given query.", + "We reached max level of depth of SBTree but still found nothing, seems like tree is in" + + " corrupted state. You should rebuild index related to given query.", this); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/singlevalue/v3/CellBTreeSingleValueV3.java b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/singlevalue/v3/CellBTreeSingleValueV3.java index 5b73e131712..962cff895e4 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/singlevalue/v3/CellBTreeSingleValueV3.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtree/singlevalue/v3/CellBTreeSingleValueV3.java @@ -1673,7 +1673,8 @@ private Optional findBucketForRemove( depth++; if (depth > MAX_PATH_LENGTH) { throw new CellBTreeSingleValueV3Exception( - "We reached max level of depth of BTree but still found nothing, seems like tree is in corrupted state. You should rebuild index related to given query.", + "We reached max level of depth of BTree but still found nothing, seems like tree is in" + + " corrupted state. You should rebuild index related to given query.", this); } @@ -1721,7 +1722,8 @@ private BucketSearchResult findBucket(final K key, final OAtomicOperation atomic depth++; if (depth > MAX_PATH_LENGTH) { throw new CellBTreeSingleValueV3Exception( - "We reached max level of depth of SBTree but still found nothing, seems like tree is in corrupted state. You should rebuild index related to given query.", + "We reached max level of depth of SBTree but still found nothing, seems like tree is in" + + " corrupted state. You should rebuild index related to given query.", this); } @@ -1759,7 +1761,8 @@ private UpdateBucketSearchResult findBucketForUpdate( while (true) { if (path.size() > MAX_PATH_LENGTH) { throw new CellBTreeSingleValueV3Exception( - "We reached max level of depth of SBTree but still found nothing, seems like tree is in corrupted state. You should rebuild index related to given query.", + "We reached max level of depth of SBTree but still found nothing, seems like tree is in" + + " corrupted state. You should rebuild index related to given query.", this); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/IntSerializer.java b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/IntSerializer.java index c4b364149e1..ea5eebf04f3 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/IntSerializer.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/IntSerializer.java @@ -98,11 +98,30 @@ public Integer deserializeFromByteBufferObject(ByteBuffer buffer) { return value; } + @Override + public Integer deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + final int numberSize = buffer.get(offset); + offset++; + + int value = 0; + for (int i = 0; i < numberSize; i++) { + value = value | ((0xFF & buffer.get(offset)) << (i * 8)); + offset++; + } + + return value; + } + @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return buffer.get() + 1; } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return buffer.get(offset) + 1; + } + @Override public Integer deserializeFromByteBufferObject( ByteBuffer buffer, OWALChanges walChanges, int offset) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/LongSerializer.java b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/LongSerializer.java index 879fd1897cb..ab1538cb194 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/LongSerializer.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/LongSerializer.java @@ -20,6 +20,10 @@ public static int getObjectSize(final ByteBuffer buffer) { return buffer.get() + 1; } + public static int getObjectSize(final ByteBuffer buffer, int offset) { + return buffer.get(offset) + 1; + } + public static int getObjectSize( final ByteBuffer buffer, final OWALChanges changes, final int position) { return changes.getByteValue(buffer, position) + 1; @@ -65,6 +69,19 @@ public static long deserialize(final ByteBuffer buffer) { return value; } + public static long deserialize(final ByteBuffer buffer, int offset) { + final int numberSize = buffer.get(offset); + offset++; + + long value = 0; + for (int i = 0; i < numberSize; i++) { + value = value | ((0xFFL & buffer.get(offset)) << (i * 8)); + offset++; + } + + return value; + } + public static long deserialize(final byte[] stream, int startPosition) { final int numberSize = stream[startPosition]; startPosition++; diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/btree/BTree.java b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/btree/BTree.java index fbe6bddd951..88dc0eb24eb 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/btree/BTree.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/btree/BTree.java @@ -687,7 +687,8 @@ private UpdateBucketSearchResult findBucketForUpdate( while (true) { if (path.size() > MAX_PATH_LENGTH) { throw new OStorageException( - "We reached max level of depth of SBTree but still found nothing, seems like tree is in corrupted state. You should rebuild index related to given query."); + "We reached max level of depth of SBTree but still found nothing, seems like tree is in" + + " corrupted state. You should rebuild index related to given query."); } path.add(pageIndex); @@ -728,7 +729,8 @@ private BucketSearchResult findBucket(final EdgeKey key, final OAtomicOperation depth++; if (depth > MAX_PATH_LENGTH) { throw new OStorageException( - "We reached max level of depth of SBTree but still found nothing, seems like tree is in corrupted state. You should rebuild index related to given query."); + "We reached max level of depth of SBTree but still found nothing, seems like tree is in" + + " corrupted state. You should rebuild index related to given query."); } try (final OCacheEntry bucketEntry = loadPageForRead(atomicOperation, fileId, pageIndex)) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/btree/EdgeKeySerializer.java b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/btree/EdgeKeySerializer.java index e6c0a981eab..f5f9471d622 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/btree/EdgeKeySerializer.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/btree/EdgeKeySerializer.java @@ -110,6 +110,21 @@ public EdgeKey deserializeFromByteBufferObject(ByteBuffer buffer) { return new EdgeKey(ownerId, targetCluster, targetPosition); } + @Override + public EdgeKey deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + var delta = LongSerializer.getObjectSize(buffer, offset); + final long ownerId = LongSerializer.deserialize(buffer, offset); + offset += delta; + + delta = IntSerializer.INSTANCE.getObjectSizeInByteBuffer(offset, buffer); + final int targetCluster = + IntSerializer.INSTANCE.deserializeFromByteBufferObject(offset, buffer); + offset += delta; + + final long targetPosition = LongSerializer.deserialize(buffer, offset); + return new EdgeKey(ownerId, targetCluster, targetPosition); + } + @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { final int position = buffer.position(); @@ -122,6 +137,18 @@ public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return size + LongSerializer.getObjectSize(buffer); } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + final int position = offset; + int size = LongSerializer.getObjectSize(buffer, offset); + offset = position + size; + + size += IntSerializer.INSTANCE.getObjectSizeInByteBuffer(offset, buffer); + offset = position + size; + + return size + LongSerializer.getObjectSize(buffer, offset); + } + @Override public EdgeKey deserializeFromByteBufferObject( ByteBuffer buffer, OWALChanges walChanges, int offset) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/local/OSBTreeBonsai.java b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/local/OSBTreeBonsai.java index b24ec83cc5d..c44d97d2ad3 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/local/OSBTreeBonsai.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/local/OSBTreeBonsai.java @@ -59,10 +59,14 @@ public interface OSBTreeBonsai extends OTreeInternal { */ long getFileId(); - /** @return the pointer to the root bucket in tree. */ + /** + * @return the pointer to the root bucket in tree. + */ OBonsaiBucketPointer getRootBucketPointer(); - /** @return pointer to a collection. */ + /** + * @return pointer to a collection. + */ OBonsaiCollectionPointer getCollectionPointer(); /** diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/local/OSBTreeBonsaiBucket.java b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/local/OSBTreeBonsaiBucket.java index 66417f1500b..5d6effce513 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/local/OSBTreeBonsaiBucket.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/local/OSBTreeBonsaiBucket.java @@ -41,6 +41,7 @@ public final class OSBTreeBonsaiBucket extends OBonsaiBucketAbstract { public static final int MAX_BUCKET_SIZE_BYTES = OGlobalConfiguration.SBTREEBONSAI_BUCKET_SIZE.getValueAsInteger() * 1024; + /** * Maximum size of key-value pair which can be put in SBTreeBonsai in bytes (24576000 by default) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/memory/ODirectMemoryOnlyDiskCache.java b/core/src/main/java/com/orientechnologies/orient/core/storage/memory/ODirectMemoryOnlyDiskCache.java index 9ac584a2ff0..286e3d4afc1 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/memory/ODirectMemoryOnlyDiskCache.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/memory/ODirectMemoryOnlyDiskCache.java @@ -571,13 +571,17 @@ public final Map files() { return result; } - /** @inheritDoc */ + /** + * @inheritDoc + */ @Override public final int pageSize() { return pageSize; } - /** @inheritDoc */ + /** + * @inheritDoc + */ @Override public final boolean fileIdsAreEqual(final long firsId, final long secondId) { final int firstIntId = extractFileId(firsId); diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/memory/ODirectMemoryStorage.java b/core/src/main/java/com/orientechnologies/orient/core/storage/memory/ODirectMemoryStorage.java index ae4e7b349e5..3bfcdd0a175 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/memory/ODirectMemoryStorage.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/memory/ODirectMemoryStorage.java @@ -81,7 +81,7 @@ public boolean exists() { try { return readCache != null && writeCache.exists("default" + OPaginatedCluster.DEF_EXTENSION); } catch (final RuntimeException e) { - throw logAndPrepareForRethrow(e, false); + throw logAndPrepareForRethrow(e); } catch (final Error e) { throw logAndPrepareForRethrow(e, false); } catch (final Throwable t) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/ridbag/ORemoteTreeRidBag.java b/core/src/main/java/com/orientechnologies/orient/core/storage/ridbag/ORemoteTreeRidBag.java index 8cfb87efd51..0bff163b4a5 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/ridbag/ORemoteTreeRidBag.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/ridbag/ORemoteTreeRidBag.java @@ -128,7 +128,8 @@ public void setOwner(ORecordElement owner) { throw new IllegalStateException( "This data structure is owned by document " + owner - + " if you want to use it in other document create new rid bag instance and copy content of current one."); + + " if you want to use it in other document create new rid bag instance and copy" + + " content of current one."); } this.owner = owner; if (this.owner != null && tracker.getTimeLine() != null) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/ridbag/sbtree/OSBTreeCollectionManagerShared.java b/core/src/main/java/com/orientechnologies/orient/core/storage/ridbag/sbtree/OSBTreeCollectionManagerShared.java index 5008c195a8a..8b773ff1852 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/ridbag/sbtree/OSBTreeCollectionManagerShared.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/ridbag/sbtree/OSBTreeCollectionManagerShared.java @@ -55,7 +55,9 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Stream; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public final class OSBTreeCollectionManagerShared implements OSBTreeCollectionManager, OOrientStartupListener, OOrientShutdownListener { public static final String FILE_EXTENSION = ".grb"; @@ -111,9 +113,9 @@ public void migrate() throws IOException { OLogManager.instance() .infoNoDb( this, - "There are found %d RidBags " - + "(containers for edges which are going to be migrated). " - + "PLEASE DO NOT SHUTDOWN YOUR DATABASE DURING MIGRATION BECAUSE THAT RISKS TO DAMAGE YOUR DATA !!!", + "There are found %d RidBags (containers for edges which are going to be migrated)." + + " PLEASE DO NOT SHUTDOWN YOUR DATABASE DURING MIGRATION BECAUSE THAT RISKS TO" + + " DAMAGE YOUR DATA !!!", filesToMigrate.size()); } else { return; diff --git a/core/src/main/java/com/orientechnologies/orient/core/storage/ridbag/sbtree/OSBTreeRidBag.java b/core/src/main/java/com/orientechnologies/orient/core/storage/ridbag/sbtree/OSBTreeRidBag.java index 07dbe2e8d74..b3633dff1fb 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/storage/ridbag/sbtree/OSBTreeRidBag.java +++ b/core/src/main/java/com/orientechnologies/orient/core/storage/ridbag/sbtree/OSBTreeRidBag.java @@ -77,6 +77,7 @@ public class OSBTreeRidBag implements ORidBagDelegate { private final OSBTreeCollectionManager collectionManager = ODatabaseRecordThreadLocal.instance().get().getSbTreeCollectionManager(); private final NavigableMap changes = new ConcurrentSkipListMap<>(); + /** Entries with not valid id. */ private final IdentityHashMap newEntries = new IdentityHashMap<>(); @@ -433,7 +434,8 @@ public void setOwner(ORecordElement owner) { throw new IllegalStateException( "This data structure is owned by document " + owner - + " if you want to use it in other document create new rid bag instance and copy content of current one."); + + " if you want to use it in other document create new rid bag instance and copy" + + " content of current one."); } if (this.owner != null) { for (OIdentifiable entry : newEntries.keySet()) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/tx/OTransaction.java b/core/src/main/java/com/orientechnologies/orient/core/tx/OTransaction.java index cb59f793b56..56296c230ff 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/tx/OTransaction.java +++ b/core/src/main/java/com/orientechnologies/orient/core/tx/OTransaction.java @@ -176,7 +176,9 @@ ORecord loadRecordIfVersionIsNotLatest( int getEntryCount(); - /** @return {@code true} if this transaction is active, {@code false} otherwise. */ + /** + * @return {@code true} if this transaction is active, {@code false} otherwise. + */ boolean isActive(); /** @@ -275,7 +277,9 @@ void addIndexEntry( */ void setCustomData(String name, Object value); - /** @return this transaction ID as seen by the client of this transaction. */ + /** + * @return this transaction ID as seen by the client of this transaction. + */ default int getClientTransactionId() { return getId(); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionAbstract.java b/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionAbstract.java index ba850db8e90..4cae71934a9 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionAbstract.java +++ b/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionAbstract.java @@ -41,6 +41,7 @@ public abstract class OTransactionAbstract implements OTransaction { protected TXSTATUS status = TXSTATUS.INVALID; protected ISOLATION_LEVEL isolationLevel = ISOLATION_LEVEL.READ_COMMITTED; protected Map locks = new HashMap(); + /** * Indicates the record deleted in a transaction. * diff --git a/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionIndexChangesPerKey.java b/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionIndexChangesPerKey.java index f591257da87..547ea2d00f1 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionIndexChangesPerKey.java +++ b/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionIndexChangesPerKey.java @@ -464,7 +464,9 @@ public int size() { return entries == null ? 0 : entries.size(); } - /** @return a copy of the entries of this object */ + /** + * @return a copy of the entries of this object + */ public List getEntriesAsList() { return Collections.unmodifiableList(new ArrayList<>(this.entries)); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionOptimistic.java b/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionOptimistic.java index d63545d8bf3..2f7cb9e4032 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionOptimistic.java +++ b/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionOptimistic.java @@ -205,9 +205,10 @@ public ORecord loadRecord( OLogManager.instance() .warn( this, - "Found record in transaction with the same RID %s but different instance. " - + "Probably the record has been loaded from another transaction and reused on the current one: reload it " - + "from current transaction before to update or delete it.", + "Found record in transaction with the same RID %s but different instance. Probably" + + " the record has been loaded from another transaction and reused on the" + + " current one: reload it from current transaction before to update or delete" + + " it.", iRecord.getIdentity()); } return txRecord; @@ -301,9 +302,10 @@ public ORecord reloadRecord( OLogManager.instance() .warn( this, - "Found record in transaction with the same RID %s but different instance. " - + "Probably the record has been loaded from another transaction and reused on the current one: reload it " - + "from current transaction before to update or delete it", + "Found record in transaction with the same RID %s but different instance. Probably" + + " the record has been loaded from another transaction and reused on the" + + " current one: reload it from current transaction before to update or delete" + + " it", passedRecord.getIdentity()); } return txRecord; diff --git a/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionRealAbstract.java b/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionRealAbstract.java index 890dbf6a3b0..843f15bc769 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionRealAbstract.java +++ b/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionRealAbstract.java @@ -56,6 +56,7 @@ public abstract class OTransactionRealAbstract extends OTransactionAbstract protected Map userData = new HashMap(); private Map noTxLocks; private Optional metadata = Optional.empty(); + /** * token This set is used to track which documents are changed during tx, if documents are changed * but not saved all changes are made during tx will be undone. diff --git a/core/src/main/java/com/orientechnologies/orient/enterprise/channel/binary/OChannelBinary.java b/core/src/main/java/com/orientechnologies/orient/enterprise/channel/binary/OChannelBinary.java index cae05115530..ff24ef1a7e8 100755 --- a/core/src/main/java/com/orientechnologies/orient/enterprise/channel/binary/OChannelBinary.java +++ b/core/src/main/java/com/orientechnologies/orient/enterprise/channel/binary/OChannelBinary.java @@ -379,7 +379,8 @@ public void clearInput() throws IOException { final String message = "Received unread response from " + socket.getRemoteSocketAddress() - + " probably corrupted data from the network connection. Cleared dirty data in the buffer (" + + " probably corrupted data from the network connection. Cleared dirty data in the" + + " buffer (" + i + " bytes): [" + dirtyBuffer diff --git a/core/src/test/java/com/orientechnologies/common/collection/OMultiValueTest.java b/core/src/test/java/com/orientechnologies/common/collection/OMultiValueTest.java index bdf40add822..b0a13f5d8f9 100644 --- a/core/src/test/java/com/orientechnologies/common/collection/OMultiValueTest.java +++ b/core/src/test/java/com/orientechnologies/common/collection/OMultiValueTest.java @@ -5,7 +5,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OMultiValueTest { @Test diff --git a/core/src/test/java/com/orientechnologies/common/concur/lock/OneEntryPerKeyLockManagerNullKeysTest.java b/core/src/test/java/com/orientechnologies/common/concur/lock/OneEntryPerKeyLockManagerNullKeysTest.java index 080ee916124..44df6294f5c 100644 --- a/core/src/test/java/com/orientechnologies/common/concur/lock/OneEntryPerKeyLockManagerNullKeysTest.java +++ b/core/src/test/java/com/orientechnologies/common/concur/lock/OneEntryPerKeyLockManagerNullKeysTest.java @@ -27,7 +27,9 @@ import org.junit.Before; import org.junit.Test; -/** @author Sergey Sitnikov */ +/** + * @author Sergey Sitnikov + */ public class OneEntryPerKeyLockManagerNullKeysTest { private OOneEntryPerKeyLockManager manager; diff --git a/core/src/test/java/com/orientechnologies/common/serialization/types/BinarySerializerTest.java b/core/src/test/java/com/orientechnologies/common/serialization/types/BinarySerializerTest.java index 51f06fb34d4..443eff3e06b 100755 --- a/core/src/test/java/com/orientechnologies/common/serialization/types/BinarySerializerTest.java +++ b/core/src/test/java/com/orientechnologies/common/serialization/types/BinarySerializerTest.java @@ -16,17 +16,19 @@ package com.orientechnologies.common.serialization.types; -import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree; +import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALPageChangesPortion; import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.junit.Assert; import org.junit.Before; +import org.junit.Test; /** * @author Ilya Bershadskiy (ibersh20-at-gmail.com) * @since 20.01.12 */ public class BinarySerializerTest { + byte[] stream; private int FIELD_SIZE; private byte[] OBJECT; @@ -40,20 +42,24 @@ public void beforeClass() { stream = new byte[FIELD_SIZE]; } + @Test public void testFieldSize() { Assert.assertEquals(binarySerializer.getObjectSize(OBJECT), FIELD_SIZE); } + @Test public void testSerialize() { binarySerializer.serialize(OBJECT, stream, 0); - Assert.assertEquals(binarySerializer.deserialize(stream, 0), OBJECT); + Assert.assertArrayEquals(binarySerializer.deserialize(stream, 0), OBJECT); } + @Test public void testSerializeNative() { binarySerializer.serializeNativeObject(OBJECT, stream, 0); - Assert.assertEquals(binarySerializer.deserializeNativeObject(stream, 0), OBJECT); + Assert.assertArrayEquals(binarySerializer.deserializeNativeObject(stream, 0), OBJECT); } + @Test public void testNativeByteBufferCompatibility() { binarySerializer.serializeNativeObject(OBJECT, stream, 0); @@ -62,9 +68,10 @@ public void testNativeByteBufferCompatibility() { buffer.put(stream); buffer.position(0); - Assert.assertEquals(binarySerializer.deserializeFromByteBufferObject(buffer), OBJECT); + Assert.assertArrayEquals(binarySerializer.deserializeFromByteBufferObject(buffer), OBJECT); } + @Test public void testSerializeByteBuffer() { final int serializationOffset = 5; final ByteBuffer buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); @@ -82,26 +89,27 @@ public void testSerializeByteBuffer() { buffer.position(serializationOffset); final byte[] result = binarySerializer.deserializeFromByteBufferObject(buffer); - Assert.assertEquals(result, OBJECT); + Assert.assertArrayEquals(result, OBJECT); } + @Test public void testSerializeInWalChanges() { final int serializationOffset = 5; final ByteBuffer buffer = - ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder()); + ByteBuffer.allocateDirect( + FIELD_SIZE + serializationOffset + OWALPageChangesPortion.PORTION_BYTES) + .order(ByteOrder.nativeOrder()); final byte[] data = new byte[FIELD_SIZE]; - final OWALChangesTree walChangesTree = new OWALChangesTree(); + final OWALPageChangesPortion walChanges = new OWALPageChangesPortion(); binarySerializer.serializeNativeObject(OBJECT, data, 0); - - walChangesTree.add(data, serializationOffset); + walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( - binarySerializer.getObjectSizeInByteBuffer(buffer, walChangesTree, serializationOffset), + binarySerializer.getObjectSizeInByteBuffer(buffer, walChanges, serializationOffset), FIELD_SIZE); - Assert.assertEquals( - binarySerializer.deserializeFromByteBufferObject( - buffer, walChangesTree, serializationOffset), + Assert.assertArrayEquals( + binarySerializer.deserializeFromByteBufferObject(buffer, walChanges, serializationOffset), OBJECT); } } diff --git a/core/src/test/java/com/orientechnologies/common/serialization/types/BooleanSerializerTest.java b/core/src/test/java/com/orientechnologies/common/serialization/types/BooleanSerializerTest.java index 590a088aa26..87b4d704431 100755 --- a/core/src/test/java/com/orientechnologies/common/serialization/types/BooleanSerializerTest.java +++ b/core/src/test/java/com/orientechnologies/common/serialization/types/BooleanSerializerTest.java @@ -17,17 +17,19 @@ package com.orientechnologies.common.serialization.types; import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges; -import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree; +import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALPageChangesPortion; import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.junit.Assert; import org.junit.Before; +import org.junit.Test; /** * @author Ilya Bershadskiy (ibersh20-at-gmail.com) * @since 18.01.12 */ public class BooleanSerializerTest { + private static final int FIELD_SIZE = 1; private static final Boolean OBJECT_TRUE = true; private static final Boolean OBJECT_FALSE = false; @@ -39,10 +41,12 @@ public void beforeClass() { booleanSerializer = new OBooleanSerializer(); } + @Test public void testFieldSize() { Assert.assertEquals(booleanSerializer.getObjectSize(null), FIELD_SIZE); } + @Test public void testSerialize() { booleanSerializer.serialize(OBJECT_TRUE, stream, 0); Assert.assertEquals(booleanSerializer.deserialize(stream, 0), OBJECT_TRUE); @@ -50,6 +54,7 @@ public void testSerialize() { Assert.assertEquals(booleanSerializer.deserialize(stream, 0), OBJECT_FALSE); } + @Test public void testSerializeNative() { booleanSerializer.serializeNative(OBJECT_TRUE, stream, 0); Assert.assertEquals(booleanSerializer.deserializeNativeObject(stream, 0), OBJECT_TRUE); @@ -57,6 +62,7 @@ public void testSerializeNative() { Assert.assertEquals(booleanSerializer.deserializeNativeObject(stream, 0), OBJECT_FALSE); } + @Test public void testNativeDirectMemoryCompatibility() { booleanSerializer.serializeNative(OBJECT_TRUE, stream, 0); @@ -72,6 +78,7 @@ public void testNativeDirectMemoryCompatibility() { Assert.assertEquals(booleanSerializer.deserializeFromByteBufferObject(buffer), OBJECT_FALSE); } + @Test public void testSerializationByteBuffer() { final int serializationOffset = 5; @@ -104,15 +111,55 @@ public void testSerializationByteBuffer() { Assert.assertEquals(booleanSerializer.deserializeFromByteBufferObject(buffer), OBJECT_FALSE); } + @Test + public void testSerializationImmutableByteBufferPosition() { + final int serializationOffset = 5; + + ByteBuffer buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); + + buffer.position(serializationOffset); + booleanSerializer.serializeInByteBufferObject(OBJECT_TRUE, buffer); + + int binarySize = buffer.position() - serializationOffset; + Assert.assertEquals(binarySize, FIELD_SIZE); + + buffer.position(serializationOffset); + Assert.assertEquals(booleanSerializer.getObjectSizeInByteBuffer(buffer), FIELD_SIZE); + + buffer.position(serializationOffset); + Assert.assertEquals(booleanSerializer.deserializeFromByteBufferObject(buffer), OBJECT_TRUE); + + buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); + + buffer.position(serializationOffset); + booleanSerializer.serializeInByteBufferObject(OBJECT_FALSE, buffer); + + binarySize = buffer.position() - serializationOffset; + Assert.assertEquals(binarySize, FIELD_SIZE); + + buffer.position(0); + Assert.assertEquals( + booleanSerializer.getObjectSizeInByteBuffer(serializationOffset, buffer), FIELD_SIZE); + Assert.assertEquals(0, buffer.position()); + + Assert.assertEquals( + booleanSerializer.deserializeFromByteBufferObject(serializationOffset, buffer), + OBJECT_FALSE); + Assert.assertEquals(0, buffer.position()); + } + + @Test public void testSerializationWalChanges() { final int serializationOffset = 5; byte[] data = new byte[FIELD_SIZE]; ByteBuffer buffer = - ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder()); + ByteBuffer.allocateDirect( + FIELD_SIZE + serializationOffset + OWALPageChangesPortion.PORTION_BYTES) + .order(ByteOrder.nativeOrder()); booleanSerializer.serializeNative(OBJECT_TRUE, data, 0); - OWALChanges walChanges = new OWALChangesTree(); + OWALChanges walChanges = new OWALPageChangesPortion(); walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( @@ -123,7 +170,7 @@ public void testSerializationWalChanges() { OBJECT_TRUE); booleanSerializer.serializeNative(OBJECT_FALSE, data, 0); - walChanges.setBinaryValue(buffer, data, 0); + walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( booleanSerializer.getObjectSizeInByteBuffer(buffer, walChanges, serializationOffset), diff --git a/core/src/test/java/com/orientechnologies/common/serialization/types/ByteSerializerTest.java b/core/src/test/java/com/orientechnologies/common/serialization/types/ByteSerializerTest.java index 5f3ccaf5758..b7971218df8 100755 --- a/core/src/test/java/com/orientechnologies/common/serialization/types/ByteSerializerTest.java +++ b/core/src/test/java/com/orientechnologies/common/serialization/types/ByteSerializerTest.java @@ -17,7 +17,7 @@ package com.orientechnologies.common.serialization.types; import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges; -import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree; +import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALPageChangesPortion; import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.junit.Assert; @@ -29,6 +29,7 @@ * @since 18.01.12 */ public class ByteSerializerTest { + private static final int FIELD_SIZE = 1; byte[] stream = new byte[FIELD_SIZE]; private static final Byte OBJECT = 1; @@ -39,6 +40,7 @@ public void beforeClass() { byteSerializer = new OByteSerializer(); } + @Test public void testFieldSize() { Assert.assertEquals(byteSerializer.getObjectSize(null), FIELD_SIZE); } @@ -49,11 +51,13 @@ public void testSerialize() { Assert.assertEquals(byteSerializer.deserialize(stream, 0), OBJECT); } + @Test public void testSerializeNative() { byteSerializer.serializeNative(OBJECT, stream, 0); Assert.assertEquals(byteSerializer.deserializeNativeObject(stream, 0), OBJECT); } + @Test public void testNativeDirectMemoryCompatibility() { byteSerializer.serializeNative(OBJECT, stream, 0); @@ -66,6 +70,7 @@ public void testNativeDirectMemoryCompatibility() { Assert.assertEquals(byteSerializer.deserializeFromByteBufferObject(buffer), OBJECT); } + @Test public void testSerializeInByteBuffer() { final int serializationOffset = 5; @@ -85,12 +90,36 @@ public void testSerializeInByteBuffer() { Assert.assertEquals(result, OBJECT); } + @Test + public void testSerializeInImmutableByteBufferPosition() { + final int serializationOffset = 5; + + final ByteBuffer buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); + buffer.position(serializationOffset); + byteSerializer.serializeInByteBufferObject(OBJECT, buffer); + + final int binarySize = buffer.position() - serializationOffset; + Assert.assertEquals(binarySize, FIELD_SIZE); + + buffer.position(0); + Assert.assertEquals( + byteSerializer.getObjectSizeInByteBuffer(serializationOffset, buffer), FIELD_SIZE); + Assert.assertEquals(0, buffer.position()); + final Byte result = byteSerializer.deserializeFromByteBufferObject(serializationOffset, buffer); + + Assert.assertEquals(0, buffer.position()); + Assert.assertEquals(result, OBJECT); + } + + @Test public void testSerializationInWALChanges() { final int serializationOffset = 5; final ByteBuffer buffer = - ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder()); + ByteBuffer.allocateDirect( + FIELD_SIZE + serializationOffset + OWALPageChangesPortion.PORTION_BYTES) + .order(ByteOrder.nativeOrder()); - final OWALChanges walChanges = new OWALChangesTree(); + final OWALChanges walChanges = new OWALPageChangesPortion(); final byte[] data = new byte[FIELD_SIZE]; byteSerializer.serializeNative(OBJECT, data, 0); walChanges.setBinaryValue(buffer, data, serializationOffset); @@ -101,5 +130,7 @@ public void testSerializationInWALChanges() { Assert.assertEquals( byteSerializer.deserializeFromByteBufferObject(buffer, walChanges, serializationOffset), OBJECT); + + Assert.assertEquals(0, buffer.position()); } } diff --git a/core/src/test/java/com/orientechnologies/common/serialization/types/CharSerializerTest.java b/core/src/test/java/com/orientechnologies/common/serialization/types/CharSerializerTest.java index 121e89d6b77..88dd556380a 100755 --- a/core/src/test/java/com/orientechnologies/common/serialization/types/CharSerializerTest.java +++ b/core/src/test/java/com/orientechnologies/common/serialization/types/CharSerializerTest.java @@ -17,7 +17,7 @@ package com.orientechnologies.common.serialization.types; import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges; -import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree; +import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALPageChangesPortion; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.Random; @@ -30,6 +30,7 @@ * @since 19.01.12 */ public class CharSerializerTest { + private static final int FIELD_SIZE = 2; private static final Character OBJECT = (char) (new Random()).nextInt(); byte[] stream = new byte[FIELD_SIZE]; @@ -69,6 +70,7 @@ public void testNativeDirectMemoryCompatibility() { Assert.assertEquals(charSerializer.deserializeFromByteBufferObject(buffer), OBJECT); } + @Test public void testSerializeInByteBuffer() { final int serializationOffset = 5; @@ -86,16 +88,39 @@ public void testSerializeInByteBuffer() { Assert.assertEquals(charSerializer.deserializeFromByteBufferObject(buffer), OBJECT); } + @Test + public void testSerializeInImmutableByteBufferPosition() { + final int serializationOffset = 5; + + final ByteBuffer buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); + buffer.position(serializationOffset); + charSerializer.serializeInByteBufferObject(OBJECT, buffer); + + final int binarySize = buffer.position() - serializationOffset; + Assert.assertEquals(binarySize, FIELD_SIZE); + + buffer.position(0); + Assert.assertEquals( + charSerializer.getObjectSizeInByteBuffer(serializationOffset, buffer), FIELD_SIZE); + Assert.assertEquals(0, buffer.position()); + + Assert.assertEquals( + charSerializer.deserializeFromByteBufferObject(serializationOffset, buffer), OBJECT); + Assert.assertEquals(0, buffer.position()); + } + @Test public void testSerializeInWALChanges() { final int serializationOffset = 5; final ByteBuffer buffer = - ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder()); + ByteBuffer.allocateDirect( + FIELD_SIZE + serializationOffset + OWALPageChangesPortion.PORTION_BYTES) + .order(ByteOrder.nativeOrder()); final byte[] data = new byte[FIELD_SIZE]; charSerializer.serializeNative(OBJECT, data, 0); - OWALChanges walChanges = new OWALChangesTree(); + OWALChanges walChanges = new OWALPageChangesPortion(); walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( @@ -104,5 +129,6 @@ public void testSerializeInWALChanges() { Assert.assertEquals( charSerializer.deserializeFromByteBufferObject(buffer, walChanges, serializationOffset), OBJECT); + Assert.assertEquals(0, buffer.position()); } } diff --git a/core/src/test/java/com/orientechnologies/common/serialization/types/DateSerializerTest.java b/core/src/test/java/com/orientechnologies/common/serialization/types/DateSerializerTest.java index 2a8ae2ce463..9944b60e930 100755 --- a/core/src/test/java/com/orientechnologies/common/serialization/types/DateSerializerTest.java +++ b/core/src/test/java/com/orientechnologies/common/serialization/types/DateSerializerTest.java @@ -17,19 +17,21 @@ package com.orientechnologies.common.serialization.types; import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges; -import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree; +import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALPageChangesPortion; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.Calendar; import java.util.Date; import org.junit.Assert; import org.junit.Before; +import org.junit.Test; /** * @author Ilya Bershadskiy (ibersh20-at-gmail.com) * @since 20.01.12 */ public class DateSerializerTest { + private static final int FIELD_SIZE = 8; private final byte[] stream = new byte[FIELD_SIZE]; private final Date OBJECT = new Date(); @@ -40,10 +42,12 @@ public void beforeClass() { dateSerializer = new ODateSerializer(); } + @Test public void testFieldSize() { Assert.assertEquals(dateSerializer.getObjectSize(OBJECT), FIELD_SIZE); } + @Test public void testSerialize() { dateSerializer.serialize(OBJECT, stream, 0); Calendar calendar = Calendar.getInstance(); @@ -55,6 +59,7 @@ public void testSerialize() { Assert.assertEquals(dateSerializer.deserialize(stream, 0), calendar.getTime()); } + @Test public void testSerializeNative() { dateSerializer.serializeNativeObject(OBJECT, stream, 0); Calendar calendar = Calendar.getInstance(); @@ -66,6 +71,7 @@ public void testSerializeNative() { Assert.assertEquals(dateSerializer.deserializeNativeObject(stream, 0), calendar.getTime()); } + @Test public void testNativeDirectMemoryCompatibility() { dateSerializer.serializeNativeObject(OBJECT, stream, 0); Calendar calendar = Calendar.getInstance(); @@ -83,6 +89,7 @@ public void testNativeDirectMemoryCompatibility() { Assert.assertEquals(dateSerializer.deserializeFromByteBufferObject(buffer), calendar.getTime()); } + @Test public void testSerializeInByteBuffer() { final int serializationOffset = 5; @@ -110,13 +117,47 @@ public void testSerializeInByteBuffer() { Assert.assertEquals(buffer.position() - serializationOffset, binarySize); } + @Test + public void testSerializeInImmutableByteBufferPosition() { + final int serializationOffset = 5; + + final ByteBuffer buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(OBJECT); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + + buffer.position(serializationOffset); + dateSerializer.serializeInByteBufferObject(OBJECT, buffer); + + final int binarySize = buffer.position() - serializationOffset; + Assert.assertEquals(binarySize, FIELD_SIZE); + + buffer.position(0); + Assert.assertEquals( + dateSerializer.getObjectSizeInByteBuffer(serializationOffset, buffer), FIELD_SIZE); + Assert.assertEquals(0, buffer.position()); + + Assert.assertEquals( + dateSerializer.deserializeFromByteBufferObject(serializationOffset, buffer), + calendar.getTime()); + Assert.assertEquals(0, buffer.position()); + } + + @Test public void testSerializeWALChanges() { final int serializationOffset = 5; final ByteBuffer buffer = - ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder()); + ByteBuffer.allocateDirect( + FIELD_SIZE + serializationOffset + OWALPageChangesPortion.PORTION_BYTES) + .order(ByteOrder.nativeOrder()); final byte[] data = new byte[FIELD_SIZE]; dateSerializer.serializeNativeObject(OBJECT, data, 0); - final OWALChanges walChanges = new OWALChangesTree(); + final OWALChanges walChanges = new OWALPageChangesPortion(); + walChanges.setBinaryValue(buffer, data, serializationOffset); Calendar calendar = Calendar.getInstance(); @@ -132,5 +173,7 @@ public void testSerializeWALChanges() { Assert.assertEquals( dateSerializer.deserializeFromByteBufferObject(buffer, walChanges, serializationOffset), calendar.getTime()); + + Assert.assertEquals(0, buffer.position()); } } diff --git a/core/src/test/java/com/orientechnologies/common/serialization/types/DateTimeSerializerTest.java b/core/src/test/java/com/orientechnologies/common/serialization/types/DateTimeSerializerTest.java index 08be4312df1..081b7143b63 100755 --- a/core/src/test/java/com/orientechnologies/common/serialization/types/DateTimeSerializerTest.java +++ b/core/src/test/java/com/orientechnologies/common/serialization/types/DateTimeSerializerTest.java @@ -17,18 +17,20 @@ package com.orientechnologies.common.serialization.types; import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges; -import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree; +import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALPageChangesPortion; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.Date; import org.junit.Assert; import org.junit.Before; +import org.junit.Test; /** * @author Ilya Bershadskiy (ibersh20-at-gmail.com) * @since 20.01.12 */ public class DateTimeSerializerTest { + private static final int FIELD_SIZE = 8; private static final Date OBJECT = new Date(); private ODateTimeSerializer dateTimeSerializer; @@ -39,20 +41,24 @@ public void beforeClass() { dateTimeSerializer = new ODateTimeSerializer(); } + @Test public void testFieldSize() { Assert.assertEquals(dateTimeSerializer.getObjectSize(OBJECT), FIELD_SIZE); } + @Test public void testSerialize() { dateTimeSerializer.serialize(OBJECT, stream, 0); Assert.assertEquals(dateTimeSerializer.deserialize(stream, 0), OBJECT); } + @Test public void testSerializeNative() { dateTimeSerializer.serializeNativeObject(OBJECT, stream, 0); Assert.assertEquals(dateTimeSerializer.deserializeNativeObject(stream, 0), OBJECT); } + @Test public void testNativeDirectMemoryCompatibility() { dateTimeSerializer.serializeNativeObject(OBJECT, stream, 0); @@ -63,6 +69,7 @@ public void testNativeDirectMemoryCompatibility() { Assert.assertEquals(dateTimeSerializer.deserializeFromByteBufferObject(buffer), OBJECT); } + @Test public void testSerializeInByteBuffer() { final int serializationOffset = 5; final ByteBuffer buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); @@ -82,14 +89,38 @@ public void testSerializeInByteBuffer() { Assert.assertEquals(buffer.position() - serializationOffset, FIELD_SIZE); } + @Test + public void testSerializeInImmutableByteBufferPosition() { + final int serializationOffset = 5; + final ByteBuffer buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); + + buffer.position(serializationOffset); + dateTimeSerializer.serializeInByteBufferObject(OBJECT, buffer); + + final int binarySize = buffer.position() - serializationOffset; + Assert.assertEquals(binarySize, FIELD_SIZE); + + buffer.position(0); + Assert.assertEquals( + dateTimeSerializer.getObjectSizeInByteBuffer(serializationOffset, buffer), FIELD_SIZE); + Assert.assertEquals(0, buffer.position()); + + Assert.assertEquals( + dateTimeSerializer.deserializeFromByteBufferObject(serializationOffset, buffer), OBJECT); + Assert.assertEquals(0, buffer.position()); + } + + @Test public void testSerializeWALChanges() { final int serializationOffset = 5; final ByteBuffer buffer = - ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder()); + ByteBuffer.allocateDirect( + FIELD_SIZE + serializationOffset + OWALPageChangesPortion.PORTION_BYTES) + .order(ByteOrder.nativeOrder()); final byte[] data = new byte[FIELD_SIZE]; dateTimeSerializer.serializeNativeObject(OBJECT, data, 0); - final OWALChanges walChanges = new OWALChangesTree(); + final OWALChanges walChanges = new OWALPageChangesPortion(); walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( diff --git a/core/src/test/java/com/orientechnologies/common/serialization/types/DecimalSerializerTest.java b/core/src/test/java/com/orientechnologies/common/serialization/types/DecimalSerializerTest.java index 8ade210a0eb..1e49626c857 100755 --- a/core/src/test/java/com/orientechnologies/common/serialization/types/DecimalSerializerTest.java +++ b/core/src/test/java/com/orientechnologies/common/serialization/types/DecimalSerializerTest.java @@ -17,19 +17,21 @@ package com.orientechnologies.common.serialization.types; import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges; -import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree; +import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALPageChangesPortion; import java.math.BigDecimal; import java.math.BigInteger; import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.junit.Assert; import org.junit.Before; +import org.junit.Test; /** * @author Andrey Lomakin (a.lomakin-at-orientdb.com) * @since 04.04.12 */ public class DecimalSerializerTest { + private static final int FIELD_SIZE = 9; private static final byte[] stream = new byte[FIELD_SIZE]; private static final BigDecimal OBJECT = new BigDecimal(new BigInteger("20"), 2); @@ -40,20 +42,24 @@ public void beforeClass() { decimalSerializer = new ODecimalSerializer(); } + @Test public void testFieldSize() { Assert.assertEquals(decimalSerializer.getObjectSize(OBJECT), FIELD_SIZE); } + @Test public void testSerialize() { decimalSerializer.serialize(OBJECT, stream, 0); Assert.assertEquals(decimalSerializer.deserialize(stream, 0), OBJECT); } + @Test public void testSerializeNative() { decimalSerializer.serializeNativeObject(OBJECT, stream, 0); Assert.assertEquals(decimalSerializer.deserializeNativeObject(stream, 0), OBJECT); } + @Test public void testNativeDirectMemoryCompatibility() { decimalSerializer.serializeNativeObject(OBJECT, stream, 0); @@ -65,6 +71,7 @@ public void testNativeDirectMemoryCompatibility() { Assert.assertEquals(decimalSerializer.deserializeFromByteBufferObject(buffer), OBJECT); } + @Test public void testSerializeInByteBuffer() { final int serializationOffset = 5; @@ -85,14 +92,39 @@ public void testSerializeInByteBuffer() { Assert.assertEquals(buffer.position() - serializationOffset, FIELD_SIZE); } + @Test + public void testSerializeInByteBufferImmutablePosition() { + final int serializationOffset = 5; + + final ByteBuffer buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); + + buffer.position(serializationOffset); + decimalSerializer.serializeInByteBufferObject(OBJECT, buffer); + + final int binarySize = buffer.position() - serializationOffset; + Assert.assertEquals(binarySize, FIELD_SIZE); + + buffer.position(0); + Assert.assertEquals( + decimalSerializer.getObjectSizeInByteBuffer(serializationOffset, buffer), FIELD_SIZE); + Assert.assertEquals(0, buffer.position()); + + Assert.assertEquals( + decimalSerializer.deserializeFromByteBufferObject(serializationOffset, buffer), OBJECT); + Assert.assertEquals(0, buffer.position()); + } + + @Test public void testSerializeWALChanges() { final int serializationOffset = 5; final ByteBuffer buffer = - ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder()); + ByteBuffer.allocateDirect( + FIELD_SIZE + serializationOffset + OWALPageChangesPortion.PORTION_BYTES) + .order(ByteOrder.nativeOrder()); final byte[] data = new byte[FIELD_SIZE]; decimalSerializer.serializeNativeObject(OBJECT, data, 0); - final OWALChanges walChanges = new OWALChangesTree(); + final OWALChanges walChanges = new OWALPageChangesPortion(); walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( diff --git a/core/src/test/java/com/orientechnologies/common/serialization/types/DoubleSerializerTest.java b/core/src/test/java/com/orientechnologies/common/serialization/types/DoubleSerializerTest.java index 1bba157c291..4ed6e2117f8 100755 --- a/core/src/test/java/com/orientechnologies/common/serialization/types/DoubleSerializerTest.java +++ b/core/src/test/java/com/orientechnologies/common/serialization/types/DoubleSerializerTest.java @@ -17,7 +17,7 @@ package com.orientechnologies.common.serialization.types; import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges; -import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree; +import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALPageChangesPortion; import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.junit.Assert; @@ -29,6 +29,7 @@ * @since 18.01.12 */ public class DoubleSerializerTest { + private static final int FIELD_SIZE = 8; private static final Double OBJECT = Math.PI; byte[] stream = new byte[FIELD_SIZE]; @@ -88,15 +89,38 @@ public void testSerializeInByteBuffer() { Assert.assertEquals(buffer.position() - serializationOffset, FIELD_SIZE); } + @Test + public void testSerializeInImmutableByteBufferPosition() { + final int serializationOffset = 5; + ByteBuffer buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); + + buffer.position(5); + doubleSerializer.serializeInByteBufferObject(OBJECT, buffer); + + final int binarySize = buffer.position() - serializationOffset; + Assert.assertEquals(binarySize, FIELD_SIZE); + + buffer.position(0); + Assert.assertEquals( + doubleSerializer.getObjectSizeInByteBuffer(serializationOffset, buffer), FIELD_SIZE); + Assert.assertEquals(0, buffer.position()); + + Assert.assertEquals( + doubleSerializer.deserializeFromByteBufferObject(serializationOffset, buffer), OBJECT); + Assert.assertEquals(0, buffer.position()); + } + @Test public void testSerializeWALChanges() { final int serializationOffset = 5; final ByteBuffer buffer = - ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder()); + ByteBuffer.allocateDirect( + FIELD_SIZE + serializationOffset + OWALPageChangesPortion.PORTION_BYTES) + .order(ByteOrder.nativeOrder()); final byte[] data = new byte[FIELD_SIZE]; doubleSerializer.serializeNativeObject(OBJECT, data, 0); - final OWALChanges walChanges = new OWALChangesTree(); + final OWALChanges walChanges = new OWALPageChangesPortion(); walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( @@ -105,5 +129,6 @@ public void testSerializeWALChanges() { Assert.assertEquals( doubleSerializer.deserializeFromByteBufferObject(buffer, walChanges, serializationOffset), OBJECT); + Assert.assertEquals(0, buffer.position()); } } diff --git a/core/src/test/java/com/orientechnologies/common/serialization/types/FloatSerializerTest.java b/core/src/test/java/com/orientechnologies/common/serialization/types/FloatSerializerTest.java index f3e49c16483..af5b39e2ca9 100755 --- a/core/src/test/java/com/orientechnologies/common/serialization/types/FloatSerializerTest.java +++ b/core/src/test/java/com/orientechnologies/common/serialization/types/FloatSerializerTest.java @@ -17,7 +17,7 @@ package com.orientechnologies.common.serialization.types; import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges; -import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree; +import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALPageChangesPortion; import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.junit.Assert; @@ -29,6 +29,7 @@ * @since 18.01.12 */ public class FloatSerializerTest { + private static final int FIELD_SIZE = 4; private static final Float OBJECT = 3.14f; byte[] stream = new byte[FIELD_SIZE]; @@ -89,16 +90,40 @@ public void testSerializeInByteBuffer() { Assert.assertEquals(buffer.position() - serializationOffset, FIELD_SIZE); } + @Test + public void testSerializeInImmutableByteBufferPosition() { + final int serializationOffset = 5; + + ByteBuffer buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); + buffer.position(serializationOffset); + + floatSerializer.serializeInByteBufferObject(OBJECT, buffer); + + final int binarySize = buffer.position() - serializationOffset; + Assert.assertEquals(binarySize, FIELD_SIZE); + + buffer.position(0); + Assert.assertEquals( + floatSerializer.getObjectSizeInByteBuffer(serializationOffset, buffer), FIELD_SIZE); + Assert.assertEquals(0, buffer.position()); + + Assert.assertEquals( + floatSerializer.deserializeFromByteBufferObject(serializationOffset, buffer), OBJECT); + Assert.assertEquals(0, buffer.position()); + } + @Test public void testSerializeWALChanges() { final int serializationOffset = 5; ByteBuffer buffer = - ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder()); + ByteBuffer.allocateDirect( + FIELD_SIZE + serializationOffset + OWALPageChangesPortion.PORTION_BYTES) + .order(ByteOrder.nativeOrder()); byte[] data = new byte[FIELD_SIZE]; floatSerializer.serializeNative(OBJECT, data, 0); - OWALChanges walChanges = new OWALChangesTree(); + OWALChanges walChanges = new OWALPageChangesPortion(); walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( diff --git a/core/src/test/java/com/orientechnologies/common/serialization/types/IntegerSerializerTest.java b/core/src/test/java/com/orientechnologies/common/serialization/types/IntegerSerializerTest.java index 4e76988ff2a..7e86b6e1d0d 100755 --- a/core/src/test/java/com/orientechnologies/common/serialization/types/IntegerSerializerTest.java +++ b/core/src/test/java/com/orientechnologies/common/serialization/types/IntegerSerializerTest.java @@ -17,17 +17,19 @@ package com.orientechnologies.common.serialization.types; import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges; -import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree; +import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALPageChangesPortion; import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.junit.Assert; import org.junit.Before; +import org.junit.Test; /** * @author Ilya Bershadskiy (ibersh20-at-gmail.com) * @since 17.01.12 */ public class IntegerSerializerTest { + private static final int FIELD_SIZE = 4; private static final Integer OBJECT = 1; private OIntegerSerializer integerSerializer; @@ -38,20 +40,24 @@ public void beforeClass() { integerSerializer = new OIntegerSerializer(); } + @Test public void testFieldSize() { Assert.assertEquals(integerSerializer.getObjectSize(null), FIELD_SIZE); } + @Test public void testSerialize() { integerSerializer.serialize(OBJECT, stream, 0); Assert.assertEquals(integerSerializer.deserialize(stream, 0), OBJECT); } + @Test public void testSerializeNative() { integerSerializer.serializeNative(OBJECT, stream, 0); Assert.assertEquals(integerSerializer.deserializeNativeObject(stream, 0), OBJECT); } + @Test public void testNativeDirectMemoryCompatibility() { integerSerializer.serializeNative(OBJECT, stream, 0); @@ -62,6 +68,7 @@ public void testNativeDirectMemoryCompatibility() { Assert.assertEquals(integerSerializer.deserializeFromByteBufferObject(buffer), OBJECT); } + @Test public void testSerializeInByteBuffer() { final int serializationOffset = 5; final ByteBuffer buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); @@ -81,14 +88,37 @@ public void testSerializeInByteBuffer() { Assert.assertEquals(buffer.position() - serializationOffset, FIELD_SIZE); } + @Test + public void testSerializeInImmutableByteBufferPosition() { + final int serializationOffset = 5; + final ByteBuffer buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); + + buffer.position(serializationOffset); + integerSerializer.serializeInByteBufferObject(OBJECT, buffer); + + final int binarySize = buffer.position() - serializationOffset; + Assert.assertEquals(binarySize, FIELD_SIZE); + + buffer.position(0); + Assert.assertEquals(integerSerializer.getObjectSizeInByteBuffer(buffer), FIELD_SIZE); + Assert.assertEquals(0, buffer.position()); + + Assert.assertEquals( + integerSerializer.deserializeFromByteBufferObject(serializationOffset, buffer), OBJECT); + Assert.assertEquals(0, buffer.position()); + } + + @Test public void testSerializeWALChanges() { final int serializationOffset = 5; final ByteBuffer buffer = - ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder()); + ByteBuffer.allocateDirect( + FIELD_SIZE + serializationOffset + OWALPageChangesPortion.PORTION_BYTES) + .order(ByteOrder.nativeOrder()); final byte[] data = new byte[FIELD_SIZE]; integerSerializer.serializeNative(OBJECT, data, 0); - OWALChanges walChanges = new OWALChangesTree(); + OWALChanges walChanges = new OWALPageChangesPortion(); walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( @@ -97,5 +127,7 @@ public void testSerializeWALChanges() { Assert.assertEquals( integerSerializer.deserializeFromByteBufferObject(buffer, walChanges, serializationOffset), OBJECT); + + Assert.assertEquals(0, buffer.position()); } } diff --git a/core/src/test/java/com/orientechnologies/common/serialization/types/LongSerializerTest.java b/core/src/test/java/com/orientechnologies/common/serialization/types/LongSerializerTest.java index 54e6bb4df19..0d883db445e 100755 --- a/core/src/test/java/com/orientechnologies/common/serialization/types/LongSerializerTest.java +++ b/core/src/test/java/com/orientechnologies/common/serialization/types/LongSerializerTest.java @@ -17,17 +17,19 @@ package com.orientechnologies.common.serialization.types; import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges; -import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree; +import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALPageChangesPortion; import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.junit.Assert; import org.junit.Before; +import org.junit.Test; /** * @author Ilya Bershadskiy (ibersh20-at-gmail.com) * @since 18.01.12 */ public class LongSerializerTest { + private static final int FIELD_SIZE = 8; private static final Long OBJECT = 999999999999999999L; private OLongSerializer longSerializer; @@ -38,20 +40,24 @@ public void beforeClass() { longSerializer = new OLongSerializer(); } + @Test public void testFieldSize() { Assert.assertEquals(longSerializer.getObjectSize(null), FIELD_SIZE); } + @Test public void testSerialize() { longSerializer.serialize(OBJECT, stream, 0); Assert.assertEquals(longSerializer.deserialize(stream, 0), OBJECT); } + @Test public void testSerializeNative() { longSerializer.serializeNative(OBJECT, stream, 0); Assert.assertEquals(longSerializer.deserializeNativeObject(stream, 0), OBJECT); } + @Test public void testNativeDirectMemoryCompatibility() { longSerializer.serializeNative(OBJECT, stream, 0); @@ -62,6 +68,7 @@ public void testNativeDirectMemoryCompatibility() { Assert.assertEquals(longSerializer.deserializeFromByteBufferObject(buffer), OBJECT); } + @Test public void testSerializeInByteBuffer() { final int serializationOffset = 5; @@ -82,14 +89,39 @@ public void testSerializeInByteBuffer() { Assert.assertEquals(buffer.position() - serializationOffset, FIELD_SIZE); } + @Test + public void testSerializeInImmutableByteBufferPosition() { + final int serializationOffset = 5; + + final ByteBuffer buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); + buffer.position(serializationOffset); + + longSerializer.serializeInByteBufferObject(OBJECT, buffer); + + final int binarySize = buffer.position() - serializationOffset; + Assert.assertEquals(binarySize, FIELD_SIZE); + + buffer.position(0); + Assert.assertEquals( + longSerializer.getObjectSizeInByteBuffer(serializationOffset, buffer), FIELD_SIZE); + Assert.assertEquals(0, buffer.position()); + + Assert.assertEquals( + longSerializer.deserializeFromByteBufferObject(serializationOffset, buffer), OBJECT); + Assert.assertEquals(0, buffer.position()); + } + + @Test public void testSerializationWALChanges() { final int serializationOffset = 5; - final ByteBuffer buffer = ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset); + final ByteBuffer buffer = + ByteBuffer.allocateDirect( + FIELD_SIZE + serializationOffset + OWALPageChangesPortion.PORTION_BYTES); final byte[] data = new byte[FIELD_SIZE]; longSerializer.serializeNative(OBJECT, data, 0); - OWALChanges walChanges = new OWALChangesTree(); + OWALChanges walChanges = new OWALPageChangesPortion(); walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( @@ -98,5 +130,7 @@ public void testSerializationWALChanges() { Assert.assertEquals( longSerializer.deserializeFromByteBufferObject(buffer, walChanges, serializationOffset), OBJECT); + + Assert.assertEquals(0, buffer.position()); } } diff --git a/core/src/test/java/com/orientechnologies/common/serialization/types/OUTFSerializerTest.java b/core/src/test/java/com/orientechnologies/common/serialization/types/OUTFSerializerTest.java index 5a36fcf5776..6772e67db4d 100755 --- a/core/src/test/java/com/orientechnologies/common/serialization/types/OUTFSerializerTest.java +++ b/core/src/test/java/com/orientechnologies/common/serialization/types/OUTFSerializerTest.java @@ -1,7 +1,7 @@ package com.orientechnologies.common.serialization.types; import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges; -import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree; +import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALPageChangesPortion; import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.junit.Assert; @@ -9,6 +9,7 @@ import org.junit.Test; public class OUTFSerializerTest { + byte[] stream; private String OBJECT; private OUTF8Serializer stringSerializer; @@ -16,9 +17,10 @@ public class OUTFSerializerTest { @Before public void beforeClass() { OBJECT = - "asd d astasf sdfrete 5678b sdf adfas ase sdf aas t sdf ts d s e34523 sdf gsd 63 sdfs ыа ы кы афц" - + "3м ыпаыву s sf s sdf asd asfsd w assf tet ы ц к к йцкуаыфв ыфафаф фаываыфав а фв аs asf s sdfsa dscas " - + " s as asdf sfsr43r344 1tasdf asa asdfa fgwe treqr3 qadfasf аывфыфцк у фыва ые унпваыва вайк ыавыфвауц"; + "asd d astasf sdfrete 5678b sdf adfas ase sdf aas t sdf ts d s e34523 sdf gsd 63 sdfs ыа ы" + + " кы афц3м ыпаыву s sf s sdf asd asfsd w assf tet ы ц к к йцкуаыфв ыфафаф фаываыфав" + + " а фв аs asf s sdfsa dscas s as asdf sfsr43r344 1tasdf asa asdfa fgwe treqr3" + + " qadfasf аывфыфцк у фыва ые унпваыва вайк ыавыфвауц"; stringSerializer = new OUTF8Serializer(); } @@ -88,17 +90,43 @@ public void testSerializeInByteBuffer() { buffer.position() - serializationOffset, stringSerializer.getObjectSize(OBJECT)); } + @Test + public void testSerializeInImmutableByteBufferPosition() { + final int serializationOffset = 5; + final ByteBuffer buffer = + ByteBuffer.allocate(stringSerializer.getObjectSize(OBJECT) + serializationOffset); + + buffer.position(serializationOffset); + stringSerializer.serializeInByteBufferObject(OBJECT, buffer); + + final int binarySize = buffer.position() - serializationOffset; + Assert.assertEquals(binarySize, stringSerializer.getObjectSize(OBJECT)); + + buffer.position(0); + Assert.assertEquals( + stringSerializer.getObjectSizeInByteBuffer(serializationOffset, buffer), + stringSerializer.getObjectSize(OBJECT)); + Assert.assertEquals(0, buffer.position()); + + Assert.assertEquals( + stringSerializer.deserializeFromByteBufferObject(serializationOffset, buffer), OBJECT); + Assert.assertEquals(0, buffer.position()); + } + @Test public void testSerializeWALChanges() { final int serializationOffset = 5; final ByteBuffer buffer = - ByteBuffer.allocateDirect(stringSerializer.getObjectSize(OBJECT) + serializationOffset) + ByteBuffer.allocateDirect( + stringSerializer.getObjectSize(OBJECT) + + serializationOffset + + OWALPageChangesPortion.PORTION_BYTES) .order(ByteOrder.nativeOrder()); final byte[] data = new byte[stringSerializer.getObjectSize(OBJECT)]; stringSerializer.serializeNativeObject(OBJECT, data, 0); - OWALChanges walChanges = new OWALChangesTree(); + OWALChanges walChanges = new OWALPageChangesPortion(); walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( @@ -107,5 +135,7 @@ public void testSerializeWALChanges() { Assert.assertEquals( stringSerializer.deserializeFromByteBufferObject(buffer, walChanges, serializationOffset), OBJECT); + + Assert.assertEquals(0, buffer.position()); } } diff --git a/core/src/test/java/com/orientechnologies/common/serialization/types/OUUIDSerializerTest.java b/core/src/test/java/com/orientechnologies/common/serialization/types/OUUIDSerializerTest.java index ed93a718e5a..127757a9d8d 100644 --- a/core/src/test/java/com/orientechnologies/common/serialization/types/OUUIDSerializerTest.java +++ b/core/src/test/java/com/orientechnologies/common/serialization/types/OUUIDSerializerTest.java @@ -1,14 +1,16 @@ package com.orientechnologies.common.serialization.types; import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges; -import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree; +import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALPageChangesPortion; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.UUID; import org.junit.Assert; import org.junit.Before; +import org.junit.Test; public class OUUIDSerializerTest { + private static final int FIELD_SIZE = 16; private static final UUID OBJECT = UUID.randomUUID(); private OUUIDSerializer uuidSerializer; @@ -18,10 +20,12 @@ public void beforeClass() { uuidSerializer = new OUUIDSerializer(); } + @Test public void testFieldSize() { Assert.assertEquals(uuidSerializer.getObjectSize(OBJECT), FIELD_SIZE); } + @Test public void testSerializationInByteBuffer() { final int serializationOffset = 5; final ByteBuffer buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); @@ -41,16 +45,40 @@ public void testSerializationInByteBuffer() { Assert.assertEquals(buffer.position() - serializationOffset, FIELD_SIZE); } + @Test + public void testSerializationInImmutableByteBufferPosition() { + final int serializationOffset = 5; + final ByteBuffer buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); + buffer.position(serializationOffset); + + uuidSerializer.serializeInByteBufferObject(OBJECT, buffer); + + final int binarySize = buffer.position() - serializationOffset; + Assert.assertEquals(binarySize, FIELD_SIZE); + + buffer.position(0); + Assert.assertEquals( + uuidSerializer.getObjectSizeInByteBuffer(serializationOffset, buffer), FIELD_SIZE); + Assert.assertEquals(0, buffer.position()); + + Assert.assertEquals( + uuidSerializer.deserializeFromByteBufferObject(serializationOffset, buffer), OBJECT); + Assert.assertEquals(0, buffer.position()); + } + + @Test public void testsSerializationWALChanges() { final int serializationOffset = 5; final ByteBuffer buffer = - ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder()); + ByteBuffer.allocateDirect( + FIELD_SIZE + serializationOffset + OWALPageChangesPortion.PORTION_BYTES) + .order(ByteOrder.nativeOrder()); final byte[] data = new byte[FIELD_SIZE]; uuidSerializer.serializeNativeObject(OBJECT, data, 0); - OWALChanges walChanges = new OWALChangesTree(); + OWALChanges walChanges = new OWALPageChangesPortion(); walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( @@ -59,5 +87,7 @@ public void testsSerializationWALChanges() { Assert.assertEquals( uuidSerializer.deserializeFromByteBufferObject(buffer, walChanges, serializationOffset), OBJECT); + + Assert.assertEquals(0, buffer.position()); } } diff --git a/core/src/test/java/com/orientechnologies/common/serialization/types/ShortSerializerTest.java b/core/src/test/java/com/orientechnologies/common/serialization/types/ShortSerializerTest.java index b212ba119fa..b169ab01839 100755 --- a/core/src/test/java/com/orientechnologies/common/serialization/types/ShortSerializerTest.java +++ b/core/src/test/java/com/orientechnologies/common/serialization/types/ShortSerializerTest.java @@ -17,17 +17,19 @@ package com.orientechnologies.common.serialization.types; import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges; -import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree; +import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALPageChangesPortion; import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.junit.Assert; import org.junit.Before; +import org.junit.Test; /** * @author Ilya Bershadskiy (ibersh20-at-gmail.com) * @since 18.01.12 */ public class ShortSerializerTest { + private static final int FIELD_SIZE = 2; byte[] stream = new byte[FIELD_SIZE]; private static final Short OBJECT = 1; @@ -38,20 +40,24 @@ public void beforeClass() { shortSerializer = new OShortSerializer(); } + @Test public void testFieldSize() { Assert.assertEquals(shortSerializer.getObjectSize(null), FIELD_SIZE); } + @Test public void testSerialize() { shortSerializer.serialize(OBJECT, stream, 0); Assert.assertEquals(shortSerializer.deserialize(stream, 0), OBJECT); } + @Test public void testSerializeNative() { shortSerializer.serializeNative(OBJECT, stream, 0); Assert.assertEquals(shortSerializer.deserializeNativeObject(stream, 0), OBJECT); } + @Test public void testNativeDirectMemoryCompatibility() { shortSerializer.serializeNative(OBJECT, stream, 0); @@ -62,6 +68,7 @@ public void testNativeDirectMemoryCompatibility() { Assert.assertEquals(shortSerializer.deserializeFromByteBufferObject(buffer), OBJECT); } + @Test public void testSerializationInByteBuffer() { final int serializationOffset = 5; @@ -82,15 +89,18 @@ public void testSerializationInByteBuffer() { Assert.assertEquals(buffer.position() - serializationOffset, FIELD_SIZE); } + @Test public void testSerializationWALChanges() { final int serializationOffset = 5; final ByteBuffer buffer = - ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder()); + ByteBuffer.allocateDirect( + FIELD_SIZE + serializationOffset + OWALPageChangesPortion.PORTION_BYTES) + .order(ByteOrder.nativeOrder()); final byte[] data = new byte[FIELD_SIZE]; shortSerializer.serializeNative(OBJECT, data, 0); - final OWALChanges walChanges = new OWALChangesTree(); + final OWALChanges walChanges = new OWALPageChangesPortion(); walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( diff --git a/core/src/test/java/com/orientechnologies/common/serialization/types/StringSerializerTest.java b/core/src/test/java/com/orientechnologies/common/serialization/types/StringSerializerTest.java index 3e70fdbd69c..012d49a7768 100755 --- a/core/src/test/java/com/orientechnologies/common/serialization/types/StringSerializerTest.java +++ b/core/src/test/java/com/orientechnologies/common/serialization/types/StringSerializerTest.java @@ -17,18 +17,20 @@ package com.orientechnologies.common.serialization.types; import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges; -import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree; +import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALPageChangesPortion; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.Random; import org.junit.Assert; import org.junit.Before; +import org.junit.Test; /** * @author Ilya Bershadskiy (ibersh20-at-gmail.com) * @since 19.01.12 */ public class StringSerializerTest { + byte[] stream; private int FIELD_SIZE; private String OBJECT; @@ -47,20 +49,24 @@ public void beforeClass() { stream = new byte[FIELD_SIZE]; } + @Test public void testFieldSize() { Assert.assertEquals(stringSerializer.getObjectSize(OBJECT), FIELD_SIZE - 7); } + @Test public void testSerialize() { stringSerializer.serialize(OBJECT, stream, 7); Assert.assertEquals(stringSerializer.deserialize(stream, 7), OBJECT); } + @Test public void testSerializeNative() { stringSerializer.serializeNativeObject(OBJECT, stream, 7); Assert.assertEquals(stringSerializer.deserializeNativeObject(stream, 7), OBJECT); } + @Test public void testNativeDirectMemoryCompatibility() { stringSerializer.serializeNativeObject(OBJECT, stream, 7); @@ -71,6 +77,7 @@ public void testNativeDirectMemoryCompatibility() { Assert.assertEquals(stringSerializer.deserializeFromByteBufferObject(buffer), OBJECT); } + @Test public void testSerializeInByteBuffer() { final int serializationOffset = 5; final ByteBuffer buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); @@ -90,16 +97,39 @@ public void testSerializeInByteBuffer() { Assert.assertEquals(buffer.position() - serializationOffset, FIELD_SIZE - 7); } + @Test + public void testSerializeInImmutableByteBufferPosition() { + final int serializationOffset = 5; + final ByteBuffer buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); + + buffer.position(serializationOffset); + stringSerializer.serializeInByteBufferObject(OBJECT, buffer); + + final int binarySize = buffer.position() - serializationOffset; + Assert.assertEquals(binarySize, FIELD_SIZE - 7); + + buffer.position(0); + Assert.assertEquals( + stringSerializer.getObjectSizeInByteBuffer(serializationOffset, buffer), FIELD_SIZE - 7); + Assert.assertEquals(0, buffer.position()); + + Assert.assertEquals( + stringSerializer.deserializeFromByteBufferObject(serializationOffset, buffer), OBJECT); + Assert.assertEquals(0, buffer.position()); + } + + @Test public void testSerializeWALChanges() { final int serializationOffset = 5; final ByteBuffer buffer = - ByteBuffer.allocateDirect(FIELD_SIZE - 7 + serializationOffset) + ByteBuffer.allocateDirect( + FIELD_SIZE - 7 + serializationOffset + OWALPageChangesPortion.PORTION_BYTES) .order(ByteOrder.nativeOrder()); final byte[] data = new byte[FIELD_SIZE - 7]; stringSerializer.serializeNativeObject(OBJECT, data, 0); - OWALChanges walChanges = new OWALChangesTree(); + OWALChanges walChanges = new OWALPageChangesPortion(); walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( @@ -108,5 +138,6 @@ public void testSerializeWALChanges() { Assert.assertEquals( stringSerializer.deserializeFromByteBufferObject(buffer, walChanges, serializationOffset), OBJECT); + Assert.assertEquals(0, buffer.position()); } } diff --git a/core/src/test/java/com/orientechnologies/orient/core/PostponedEngineStartTest.java b/core/src/test/java/com/orientechnologies/orient/core/PostponedEngineStartTest.java index 3628e141317..51f3ab5abbb 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/PostponedEngineStartTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/PostponedEngineStartTest.java @@ -56,7 +56,9 @@ import org.junit.BeforeClass; import org.junit.Test; -/** @author Sergey Sitnikov */ +/** + * @author Sergey Sitnikov + */ public class PostponedEngineStartTest { private static Orient ORIENT; @@ -282,7 +284,7 @@ public void delete() {} public void close() {} @Override - public void close(boolean iForce, boolean onDelete) {} + public void close(boolean iForce) {} @Override public boolean isClosed() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/command/script/JSScriptTest.java b/core/src/test/java/com/orientechnologies/orient/core/command/script/JSScriptTest.java index 04832a0eb0a..8bbb33f8566 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/command/script/JSScriptTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/command/script/JSScriptTest.java @@ -198,7 +198,8 @@ public void jsSandboxWithDB() { OResultSet resultSet = db.execute( "javascript", - "var elem = db.query(\"select from OUser\").stream().findFirst().get(); elem.getProperty(\"name\")"); + "var elem = db.query(\"select from OUser\").stream().findFirst().get();" + + " elem.getProperty(\"name\")"); Assert.assertEquals(1, resultSet.stream().count()); } finally { orientDB.drop(name.getMethodName()); diff --git a/core/src/test/java/com/orientechnologies/orient/core/command/traverse/OTraverseTest.java b/core/src/test/java/com/orientechnologies/orient/core/command/traverse/OTraverseTest.java index 65a4423c0c9..e5fdcef3709 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/command/traverse/OTraverseTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/command/traverse/OTraverseTest.java @@ -9,7 +9,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public class OTraverseTest extends BaseMemoryDatabase { private ODocument rootDocument; diff --git a/core/src/test/java/com/orientechnologies/orient/core/db/FreezeAndRecordInsertAtomicityTest.java b/core/src/test/java/com/orientechnologies/orient/core/db/FreezeAndRecordInsertAtomicityTest.java index 3327621bcfd..2c4919d709e 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/db/FreezeAndRecordInsertAtomicityTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/db/FreezeAndRecordInsertAtomicityTest.java @@ -44,7 +44,9 @@ import org.junit.Before; import org.junit.Test; -/** @author Sergey Sitnikov */ +/** + * @author Sergey Sitnikov + */ public class FreezeAndRecordInsertAtomicityTest { private static final String URL; diff --git a/core/src/test/java/com/orientechnologies/orient/core/db/OViewRefreshIT.java b/core/src/test/java/com/orientechnologies/orient/core/db/OViewRefreshIT.java index 85574d7fbc8..c0c5ea4950c 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/db/OViewRefreshIT.java +++ b/core/src/test/java/com/orientechnologies/orient/core/db/OViewRefreshIT.java @@ -217,7 +217,8 @@ public void testBigDataParallelIndexRefresh() throws InterruptedException { + i + " FROM (SELECT name FROM " + className - + " where toChange=\"data\") metadata {\"updateIntervalSeconds\":5, indexes:[{type:\"NOTUNIQUE\", properties:{name:\"String\"}}] } "; + + " where toChange=\"data\") metadata {\"updateIntervalSeconds\":5," + + " indexes:[{type:\"NOTUNIQUE\", properties:{name:\"String\"}}] } "; db.command(statement); } diff --git a/core/src/test/java/com/orientechnologies/orient/core/db/OrientDBEmbeddedTests.java b/core/src/test/java/com/orientechnologies/orient/core/db/OrientDBEmbeddedTests.java index a48143cd7bc..73eb55eedcc 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/db/OrientDBEmbeddedTests.java +++ b/core/src/test/java/com/orientechnologies/orient/core/db/OrientDBEmbeddedTests.java @@ -716,10 +716,12 @@ public void testCreateDatabaseViaSQLIfNotExistsWithUsers() { .addConfig(OGlobalConfiguration.CREATE_DEFAULT_USERS, false) .build()); orientDB.execute( - "create database test memory if not exists users(admin identified by 'adminpwd' role admin)"); + "create database test memory if not exists users(admin identified by 'adminpwd' role" + + " admin)"); orientDB.execute( - "create database test memory if not exists users(admin identified by 'adminpwd' role admin)"); + "create database test memory if not exists users(admin identified by 'adminpwd' role" + + " admin)"); try (ODatabaseSession session = orientDB.open("test", "admin", "adminpwd")) {} diff --git a/core/src/test/java/com/orientechnologies/orient/core/db/document/VersionedDeleteTest.java b/core/src/test/java/com/orientechnologies/orient/core/db/document/VersionedDeleteTest.java index d1fe9d9578b..398e38d6e44 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/db/document/VersionedDeleteTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/db/document/VersionedDeleteTest.java @@ -25,7 +25,9 @@ import org.junit.Ignore; import org.junit.Test; -/** @author Sergey Sitnikov */ +/** + * @author Sergey Sitnikov + */ public class VersionedDeleteTest extends BaseMemoryDatabase { @Test(expected = OConcurrentModificationException.class) diff --git a/core/src/test/java/com/orientechnologies/orient/core/db/hook/CheckHookCallCountTest.java b/core/src/test/java/com/orientechnologies/orient/core/db/hook/CheckHookCallCountTest.java index c21c0fb8250..84ddeaaab84 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/db/hook/CheckHookCallCountTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/db/hook/CheckHookCallCountTest.java @@ -34,7 +34,8 @@ public void testMultipleCallHook() { first.field(FIELD_STATUS, STATUS); db.save(first); - db.query("SELECT FROM " + CLASS_NAME + " WHERE " + FIELD_STATUS + " = '" + STATUS + "'") + db + .query("SELECT FROM " + CLASS_NAME + " WHERE " + FIELD_STATUS + " = '" + STATUS + "'") .stream() .count(); // assertEquals(hook.readCount, 1); //TODO diff --git a/core/src/test/java/com/orientechnologies/orient/core/db/record/TestTypeGuessingWorkingWithSQLAndMultiValues.java b/core/src/test/java/com/orientechnologies/orient/core/db/record/TestTypeGuessingWorkingWithSQLAndMultiValues.java index a52c479f597..7c3bed77059 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/db/record/TestTypeGuessingWorkingWithSQLAndMultiValues.java +++ b/core/src/test/java/com/orientechnologies/orient/core/db/record/TestTypeGuessingWorkingWithSQLAndMultiValues.java @@ -8,7 +8,9 @@ import org.junit.Before; import org.junit.Test; -/** @author Luca Garulli (l.garulli--(at)--orientdb.com) */ +/** + * @author Luca Garulli (l.garulli--(at)--orientdb.com) + */ public class TestTypeGuessingWorkingWithSQLAndMultiValues extends BaseMemoryDatabase { @Before @@ -34,8 +36,12 @@ public void testLinkedValue() { try (OResultSet result = db.execute( "sql", - "insert into client set name = 'James Bond', phones = ['1234', '34567'], addresses = [{'@class':'Address','city':'Shanghai', 'zip':'3999'}, {'@class':'Address','city':'New York', 'street':'57th Ave'}]\n;" - + "update client set addresses = addresses || [{'@type':'d','@class':'Address','city':'London', 'zip':'67373'}] return after;")) { + "insert into client set name = 'James Bond', phones = ['1234', '34567'], addresses =" + + " [{'@class':'Address','city':'Shanghai', 'zip':'3999'}," + + " {'@class':'Address','city':'New York', 'street':'57th Ave'}]\n" + + ";update client set addresses = addresses ||" + + " [{'@type':'d','@class':'Address','city':'London', 'zip':'67373'}] return" + + " after;")) { Assert.assertTrue(result.hasNext()); @@ -48,7 +54,8 @@ public void testLinkedValue() { try (OResultSet result = db.command( - "update client set addresses = addresses || [{'city':'London', 'zip':'67373'}] return after")) { + "update client set addresses = addresses || [{'city':'London', 'zip':'67373'}] return" + + " after")) { Assert.assertTrue(result.hasNext()); OResult doc = result.next(); diff --git a/core/src/test/java/com/orientechnologies/orient/core/index/OCompositeIndexSQLInsertTest.java b/core/src/test/java/com/orientechnologies/orient/core/index/OCompositeIndexSQLInsertTest.java index 20db51d2761..975572b1b21 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/index/OCompositeIndexSQLInsertTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/index/OCompositeIndexSQLInsertTest.java @@ -37,20 +37,25 @@ public void testCompositeIndexWithRangeAndContains() { clazz.createProperty("name", OType.STRING); db.command( - "create index CompositeIndexWithRangeAndConditions_id_tags_name on CompositeIndexWithRangeAndConditions (id, tags, name) NOTUNIQUE") + "create index CompositeIndexWithRangeAndConditions_id_tags_name on" + + " CompositeIndexWithRangeAndConditions (id, tags, name) NOTUNIQUE") .close(); db.command( - "insert into CompositeIndexWithRangeAndConditions set id = 1, tags = [\"green\",\"yellow\"] , name = \"Foo\", bar = 1") + "insert into CompositeIndexWithRangeAndConditions set id = 1, tags =" + + " [\"green\",\"yellow\"] , name = \"Foo\", bar = 1") .close(); db.command( - "insert into CompositeIndexWithRangeAndConditions set id = 1, tags = [\"blue\",\"black\"] , name = \"Foo\", bar = 14") + "insert into CompositeIndexWithRangeAndConditions set id = 1, tags =" + + " [\"blue\",\"black\"] , name = \"Foo\", bar = 14") .close(); db.command( - "insert into CompositeIndexWithRangeAndConditions set id = 1, tags = [\"white\"] , name = \"Foo\"") + "insert into CompositeIndexWithRangeAndConditions set id = 1, tags = [\"white\"] , name" + + " = \"Foo\"") .close(); db.command( - "insert into CompositeIndexWithRangeAndConditions set id = 1, tags = [\"green\",\"yellow\"], name = \"Foo1\", bar = 14") + "insert into CompositeIndexWithRangeAndConditions set id = 1, tags =" + + " [\"green\",\"yellow\"], name = \"Foo1\", bar = 14") .close(); OResultSet res = @@ -62,7 +67,8 @@ public void testCompositeIndexWithRangeAndContains() { long count1 = db .query( - "select from CompositeIndexWithRangeAndConditions where id = 1 and tags CONTAINS \"white\"") + "select from CompositeIndexWithRangeAndConditions where id = 1 and tags CONTAINS" + + " \"white\"") .stream() .count(); Assert.assertEquals(count1, 1); @@ -70,13 +76,15 @@ public void testCompositeIndexWithRangeAndContains() { long count2 = db .query( - "select from CompositeIndexWithRangeAndConditions where id > 0 and tags CONTAINS \"white\"") + "select from CompositeIndexWithRangeAndConditions where id > 0 and tags CONTAINS" + + " \"white\"") .stream() .count(); Assert.assertEquals(count2, 1); long count3 = - db.query("select from CompositeIndexWithRangeAndConditions where id > 0 and bar = 1") + db + .query("select from CompositeIndexWithRangeAndConditions where id > 0 and bar = 1") .stream() .count(); @@ -85,7 +93,8 @@ public void testCompositeIndexWithRangeAndContains() { long count4 = db .query( - "select from CompositeIndexWithRangeAndConditions where tags CONTAINS \"white\" and id > 0") + "select from CompositeIndexWithRangeAndConditions where tags CONTAINS \"white\" and" + + " id > 0") .stream() .count(); Assert.assertEquals(count4, 1); diff --git a/core/src/test/java/com/orientechnologies/orient/core/index/OCompositeKeyTest.java b/core/src/test/java/com/orientechnologies/orient/core/index/OCompositeKeyTest.java index 13035c0c548..2e6035da594 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/index/OCompositeKeyTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/index/OCompositeKeyTest.java @@ -1,7 +1,7 @@ package com.orientechnologies.orient.core.index; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertTrue; @@ -9,7 +9,7 @@ import com.orientechnologies.orient.core.serialization.serializer.binary.impl.index.OCompositeKeySerializer; import com.orientechnologies.orient.core.serialization.serializer.record.binary.ORecordSerializerNetworkV37; import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges; -import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree; +import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALPageChangesPortion; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; @@ -32,8 +32,8 @@ public void testEqualSameKeys() { anotherCompositeKey.addKey("a"); anotherCompositeKey.addKey("b"); - assertTrue(compositeKey.equals(anotherCompositeKey)); - assertTrue(compositeKey.hashCode() == anotherCompositeKey.hashCode()); + assertEquals(compositeKey, anotherCompositeKey); + assertEquals(compositeKey.hashCode(), anotherCompositeKey.hashCode()); } @Test @@ -48,25 +48,26 @@ public void testEqualNotSameKeys() { anotherCompositeKey.addKey("b"); anotherCompositeKey.addKey("c"); - assertFalse(compositeKey.equals(anotherCompositeKey)); + assertNotEquals(compositeKey, anotherCompositeKey); } @Test public void testEqualNull() { final OCompositeKey compositeKey = new OCompositeKey(); - assertFalse(compositeKey.equals(null)); + assertNotEquals(null, compositeKey); } @Test public void testEqualSame() { final OCompositeKey compositeKey = new OCompositeKey(); - assertTrue(compositeKey.equals(compositeKey)); + //noinspection EqualsWithItself + assertEquals(compositeKey, compositeKey); } @Test public void testEqualDiffClass() { final OCompositeKey compositeKey = new OCompositeKey(); - assertFalse(compositeKey.equals("1")); + assertNotEquals("1", compositeKey); } @Test @@ -319,11 +320,12 @@ public void testWALChangesBinarySerializationCompositeKeyNull() { final int len = OCompositeKeySerializer.INSTANCE.getObjectSize(compositeKey); final ByteBuffer buffer = - ByteBuffer.allocateDirect(len + serializationOffset).order(ByteOrder.nativeOrder()); + ByteBuffer.allocateDirect(len + serializationOffset + OWALPageChangesPortion.PORTION_BYTES) + .order(ByteOrder.nativeOrder()); final byte[] data = new byte[len]; OCompositeKeySerializer.INSTANCE.serializeNativeObject(compositeKey, data, 0); - final OWALChanges walChanges = new OWALChangesTree(); + final OWALChanges walChanges = new OWALPageChangesPortion(); walChanges.setBinaryValue(buffer, data, serializationOffset); assertEquals( diff --git a/core/src/test/java/com/orientechnologies/orient/core/index/TxNonUniqueIndexWithCollationTest.java b/core/src/test/java/com/orientechnologies/orient/core/index/TxNonUniqueIndexWithCollationTest.java index 2fd7ff051ce..ac362d03624 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/index/TxNonUniqueIndexWithCollationTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/index/TxNonUniqueIndexWithCollationTest.java @@ -33,7 +33,9 @@ import org.junit.Before; import org.junit.Test; -/** @author Sergey Sitnikov */ +/** + * @author Sergey Sitnikov + */ public class TxNonUniqueIndexWithCollationTest extends BaseMemoryDatabase { @Before diff --git a/core/src/test/java/com/orientechnologies/orient/core/index/TxUniqueIndexWithCollationTest.java b/core/src/test/java/com/orientechnologies/orient/core/index/TxUniqueIndexWithCollationTest.java index 88dd3122f88..2f75559d434 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/index/TxUniqueIndexWithCollationTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/index/TxUniqueIndexWithCollationTest.java @@ -32,7 +32,9 @@ import com.orientechnologies.orient.core.sql.query.OLegacyResultSet; import org.junit.Test; -/** @author Sergey Sitnikov */ +/** + * @author Sergey Sitnikov + */ public class TxUniqueIndexWithCollationTest extends BaseMemoryDatabase { public void beforeTest() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/iterator/ClassIteratorTest.java b/core/src/test/java/com/orientechnologies/orient/core/iterator/ClassIteratorTest.java index f141df023e2..f389c1369c6 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/iterator/ClassIteratorTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/iterator/ClassIteratorTest.java @@ -12,7 +12,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Artem Loginov */ +/** + * @author Artem Loginov + */ public class ClassIteratorTest extends BaseMemoryDatabase { private Set names; diff --git a/core/src/test/java/com/orientechnologies/orient/core/metadata/schema/OViewTest.java b/core/src/test/java/com/orientechnologies/orient/core/metadata/schema/OViewTest.java index c6d0cf3fbb7..afd811c6812 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/metadata/schema/OViewTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/metadata/schema/OViewTest.java @@ -70,7 +70,9 @@ public void testCloseDatabase() throws InterruptedException { session.createClass("test"); session .command( - "create view test_view from( select name from test ) metadata {updateIntervalSeconds:1, indexes: [{type:'NOTUNIQUE', properties:{name:'STRING'}}]}") + "create view test_view from( select name from test ) metadata" + + " {updateIntervalSeconds:1, indexes: [{type:'NOTUNIQUE'," + + " properties:{name:'STRING'}}]}") .close(); session.command("insert into test set name='abc'").close(); diff --git a/core/src/test/java/com/orientechnologies/orient/core/metadata/security/OSecurityEngineTest.java b/core/src/test/java/com/orientechnologies/orient/core/metadata/security/OSecurityEngineTest.java index 59999a610b1..b5a42edaca8 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/metadata/security/OSecurityEngineTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/metadata/security/OSecurityEngineTest.java @@ -25,7 +25,7 @@ public class OSecurityEngineTest { public static void beforeClass() { orient = new OrientDB( - "plocal:.", + "plocal:./target/securityEngineTest", OrientDBConfig.builder() .addConfig(OGlobalConfiguration.CREATE_DEFAULT_USERS, false) .build()); @@ -200,7 +200,8 @@ public void testTwoSuperclasses() { public void testTwoRoles() { db.command( - "Update OUser set roles = roles || (select from orole where name = 'reader') where name = 'admin'"); + "Update OUser set roles = roles || (select from orole where name = 'reader') where name =" + + " 'admin'"); db.close(); db = orient.open(DB_NAME, "admin", OCreateDatabaseUtil.NEW_ADMIN_PASSWORD); diff --git a/core/src/test/java/com/orientechnologies/orient/core/metadata/sequence/OSequenceTest.java b/core/src/test/java/com/orientechnologies/orient/core/metadata/sequence/OSequenceTest.java index f6d4bbe7b85..7cf585edccf 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/metadata/sequence/OSequenceTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/metadata/sequence/OSequenceTest.java @@ -260,7 +260,8 @@ public void shouldSequenceWithDefaultValueNoTx() { db.command("CREATE CLASS Person EXTENDS V"); db.command("CREATE SEQUENCE personIdSequence TYPE ORDERED;"); db.command( - "CREATE PROPERTY Person.id LONG (MANDATORY TRUE, default \"sequence('personIdSequence').next()\");"); + "CREATE PROPERTY Person.id LONG (MANDATORY TRUE, default" + + " \"sequence('personIdSequence').next()\");"); db.command("CREATE INDEX Person.id ON Person (id) UNIQUE"); for (int i = 0; i < 10; i++) { @@ -278,7 +279,8 @@ public void shouldSequenceWithDefaultValueTx() { db.command("CREATE CLASS Person EXTENDS V"); db.command("CREATE SEQUENCE personIdSequence TYPE ORDERED;"); db.command( - "CREATE PROPERTY Person.id LONG (MANDATORY TRUE, default \"sequence('personIdSequence').next()\");"); + "CREATE PROPERTY Person.id LONG (MANDATORY TRUE, default" + + " \"sequence('personIdSequence').next()\");"); db.command("CREATE INDEX Person.id ON Person (id) UNIQUE"); db.begin(); diff --git a/core/src/test/java/com/orientechnologies/orient/core/record/impl/BinaryComparatorCompareTest.java b/core/src/test/java/com/orientechnologies/orient/core/record/impl/BinaryComparatorCompareTest.java index 45ee78dea6c..b58f9815e3c 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/record/impl/BinaryComparatorCompareTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/record/impl/BinaryComparatorCompareTest.java @@ -13,7 +13,8 @@ import org.junit.Assert; import org.junit.Test; -public class BinaryComparatorCompareTest extends AbstractComparatorTest {; +public class BinaryComparatorCompareTest extends AbstractComparatorTest { + ; @Test public void testInteger() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/record/impl/ODocumentTest.java b/core/src/test/java/com/orientechnologies/orient/core/record/impl/ODocumentTest.java index 6b3fd95ef5f..d58112bdfe9 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/record/impl/ODocumentTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/record/impl/ODocumentTest.java @@ -26,7 +26,9 @@ import org.assertj.core.api.Assertions; import org.junit.Test; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public class ODocumentTest { private static final String dbName = ODocumentTest.class.getSimpleName(); private static final String defaultDbAdminCredentials = "admin"; diff --git a/core/src/test/java/com/orientechnologies/orient/core/record/impl/ORecordBytesTest.java b/core/src/test/java/com/orientechnologies/orient/core/record/impl/ORecordBytesTest.java index 941cc3fa8ac..08feed426a7 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/record/impl/ORecordBytesTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/record/impl/ORecordBytesTest.java @@ -25,7 +25,9 @@ import org.junit.Before; import org.junit.Test; -/** @author bogdan */ +/** + * @author bogdan + */ public class ORecordBytesTest { private static final int SMALL_ARRAY = 3; private static final int BIG_ARRAY = 7; diff --git a/core/src/test/java/com/orientechnologies/orient/core/security/ResourceDerivedTest.java b/core/src/test/java/com/orientechnologies/orient/core/security/ResourceDerivedTest.java index f549a021e19..b625b8c7760 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/security/ResourceDerivedTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/security/ResourceDerivedTest.java @@ -29,7 +29,9 @@ import org.junit.Before; import org.junit.Test; -/** @author SDIPro */ +/** + * @author SDIPro + */ public class ResourceDerivedTest { private OrientDB orientDB; @@ -41,9 +43,11 @@ public void before() { ODatabaseSession db = orientDB.open("test", "admin", "admin"); db.command( - "CREATE SECURITY POLICY r SET create = (false), read = (true), before update = (false), after update = (false), delete = (false), execute = (true)"); + "CREATE SECURITY POLICY r SET create = (false), read = (true), before update = (false)," + + " after update = (false), delete = (false), execute = (true)"); db.command( - "CREATE SECURITY POLICY rw SET create = (true), read = (true), before update = (true), after update = (true), delete = (true), execute = (true)"); + "CREATE SECURITY POLICY rw SET create = (true), read = (true), before update = (true)," + + " after update = (true), delete = (true), execute = (true)"); db.command("CREATE CLASS Customer extends V ABSTRACT"); db.command("CREATE PROPERTY Customer.name String"); @@ -71,7 +75,8 @@ public void before() { "tenant1"); db.command( - "INSERT INTO OUser set name = 'tenant1', password = 'password', status = 'ACTIVE', roles = (SELECT FROM ORole WHERE name = 'tenant1')"); + "INSERT INTO OUser set name = 'tenant1', password = 'password', status = 'ACTIVE', roles =" + + " (SELECT FROM ORole WHERE name = 'tenant1')"); db.command("INSERT INTO ORole SET name = 'tenant2', mode = 0"); db.command("ALTER ROLE tenant2 set policy rw ON database.class.*.*"); @@ -82,10 +87,12 @@ public void before() { db.command("ALTER ROLE tenant2 set policy rw ON database.class.Customer_t2"); db.command("UPDATE ORole SET rules = {'database.class.customer': 0} WHERE name = ?", "tenant2"); db.command( - "UPDATE ORole SET inheritedRole = (SELECT FROM ORole WHERE name = 'reader') WHERE name = 'tenant2'"); + "UPDATE ORole SET inheritedRole = (SELECT FROM ORole WHERE name = 'reader') WHERE name =" + + " 'tenant2'"); db.command( - "INSERT INTO OUser set name = 'tenant2', password = 'password', status = 'ACTIVE', roles = (SELECT FROM ORole WHERE name = 'tenant2')"); + "INSERT INTO OUser set name = 'tenant2', password = 'password', status = 'ACTIVE', roles =" + + " (SELECT FROM ORole WHERE name = 'tenant2')"); db.command("INSERT INTO Customer_t1 set name='Amy'"); db.command("INSERT INTO Customer_t2 set name='Bob'"); diff --git a/core/src/test/java/com/orientechnologies/orient/core/security/symmetrickey/OSymmetricKeyTest.java b/core/src/test/java/com/orientechnologies/orient/core/security/symmetrickey/OSymmetricKeyTest.java index 76e41e8884e..1c507a54082 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/security/symmetrickey/OSymmetricKeyTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/security/symmetrickey/OSymmetricKeyTest.java @@ -5,7 +5,9 @@ import com.orientechnologies.orient.core.db.document.ODatabaseDocument; import org.junit.Test; -/** @author S. Colin Leister */ +/** + * @author S. Colin Leister + */ public class OSymmetricKeyTest { private void command(ODatabaseDocument db, String sql, Object... params) { diff --git a/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/CompactedLinkSerializerTest.java b/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/CompactedLinkSerializerTest.java index 58ef4768a02..b6dd93f3da8 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/CompactedLinkSerializerTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/CompactedLinkSerializerTest.java @@ -117,6 +117,27 @@ public void testSerializeOneByteByteBuffer() { Assert.assertEquals(rid, restoredRid); } + @Test + public void testSerializeOneByteByteImmutableBufferPosition() { + final OCompactedLinkSerializer linkSerializer = new OCompactedLinkSerializer(); + + final ORecordId rid = new ORecordId(123, 230); + final int size = linkSerializer.getObjectSize(rid); + + final ByteBuffer buffer = ByteBuffer.allocate(size + 1); + buffer.position(1); + linkSerializer.serializeInByteBufferObject(rid, buffer); + + buffer.position(0); + Assert.assertEquals(size, linkSerializer.getObjectSizeInByteBuffer(1, buffer)); + Assert.assertEquals(0, buffer.position()); + + final OIdentifiable restoredRid = linkSerializer.deserializeFromByteBufferObject(1, buffer); + Assert.assertEquals(0, buffer.position()); + + Assert.assertEquals(rid, restoredRid); + } + @Test public void testSerializeTwoBytesByteBuffer() { final OCompactedLinkSerializer linkSerializer = new OCompactedLinkSerializer(); @@ -136,6 +157,27 @@ public void testSerializeTwoBytesByteBuffer() { Assert.assertEquals(rid, restoredRid); } + @Test + public void testSerializeTwoBytesByteImmutableBufferPosition() { + final OCompactedLinkSerializer linkSerializer = new OCompactedLinkSerializer(); + + final ORecordId rid = new ORecordId(123, 325); + final int size = linkSerializer.getObjectSize(rid); + + ByteBuffer buffer = ByteBuffer.allocate(size + 1); + buffer.position(1); + linkSerializer.serializeInByteBufferObject(rid, buffer); + + buffer.position(0); + Assert.assertEquals(size, linkSerializer.getObjectSizeInByteBuffer(1, buffer)); + Assert.assertEquals(0, buffer.position()); + + final OIdentifiable restoredRid = linkSerializer.deserializeFromByteBufferObject(1, buffer); + Assert.assertEquals(0, buffer.position()); + + Assert.assertEquals(rid, restoredRid); + } + @Test public void testSerializeThreeBytesInByteBuffer() { final OCompactedLinkSerializer linkSerializer = new OCompactedLinkSerializer(); @@ -154,4 +196,25 @@ public void testSerializeThreeBytesInByteBuffer() { final OIdentifiable restoredRid = linkSerializer.deserializeFromByteBufferObject(buffer); Assert.assertEquals(rid, restoredRid); } + + @Test + public void testSerializeThreeBytesInByteImmutableBufferPosition() { + final OCompactedLinkSerializer linkSerializer = new OCompactedLinkSerializer(); + + final ORecordId rid = new ORecordId(123, 65628); + final int size = linkSerializer.getObjectSize(rid); + + ByteBuffer buffer = ByteBuffer.allocate(size + 1); + buffer.position(1); + linkSerializer.serializeInByteBufferObject(rid, buffer); + + buffer.position(0); + Assert.assertEquals(size, linkSerializer.getObjectSizeInByteBuffer(1, buffer)); + Assert.assertEquals(0, buffer.position()); + + final OIdentifiable restoredRid = linkSerializer.deserializeFromByteBufferObject(1, buffer); + Assert.assertEquals(0, buffer.position()); + + Assert.assertEquals(rid, restoredRid); + } } diff --git a/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/LinkSerializerTest.java b/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/LinkSerializerTest.java index e72903c0c16..375aad53838 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/LinkSerializerTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/LinkSerializerTest.java @@ -20,16 +20,18 @@ import com.orientechnologies.common.serialization.types.OShortSerializer; import com.orientechnologies.orient.core.id.ORecordId; import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges; -import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree; +import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALPageChangesPortion; import java.nio.ByteBuffer; import org.junit.Assert; import org.junit.Before; +import org.junit.Test; /** * @author Ilya Bershadskiy (ibersh20-at-gmail.com) * @since 07.02.12 */ public class LinkSerializerTest { + private static final int FIELD_SIZE = OShortSerializer.SHORT_SIZE + OLongSerializer.LONG_SIZE; byte[] stream = new byte[FIELD_SIZE]; private static final int clusterId = 5; @@ -43,15 +45,18 @@ public void beforeClass() { linkSerializer = new OLinkSerializer(); } + @Test public void testFieldSize() { Assert.assertEquals(linkSerializer.getObjectSize(null), FIELD_SIZE); } + @Test public void testSerialize() { linkSerializer.serialize(OBJECT, stream, 0); Assert.assertEquals(linkSerializer.deserialize(stream, 0), OBJECT); } + @Test public void testSerializeInByteBuffer() { final int serializationOffset = 5; @@ -72,14 +77,39 @@ public void testSerializeInByteBuffer() { Assert.assertEquals(buffer.position() - serializationOffset, FIELD_SIZE); } + @Test + public void testSerializeInImmutableByteBufferPosition() { + final int serializationOffset = 5; + + final ByteBuffer buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); + + buffer.position(serializationOffset); + linkSerializer.serializeInByteBufferObject(OBJECT, buffer); + + final int binarySize = buffer.position() - serializationOffset; + Assert.assertEquals(binarySize, FIELD_SIZE); + + buffer.position(0); + Assert.assertEquals( + linkSerializer.getObjectSizeInByteBuffer(serializationOffset, buffer), FIELD_SIZE); + Assert.assertEquals(0, buffer.position()); + + Assert.assertEquals( + linkSerializer.deserializeFromByteBufferObject(serializationOffset, buffer), OBJECT); + Assert.assertEquals(0, buffer.position()); + } + + @Test public void testSerializeWALChanges() { final int serializationOffset = 5; - final ByteBuffer buffer = ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset); + final ByteBuffer buffer = + ByteBuffer.allocateDirect( + FIELD_SIZE + serializationOffset + OWALPageChangesPortion.PORTION_BYTES); final byte[] data = new byte[FIELD_SIZE]; linkSerializer.serializeNativeObject(OBJECT, data, 0); - final OWALChanges walChanges = new OWALChangesTree(); + final OWALChanges walChanges = new OWALPageChangesPortion(); walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( @@ -88,5 +118,7 @@ public void testSerializeWALChanges() { Assert.assertEquals( linkSerializer.deserializeFromByteBufferObject(buffer, walChanges, serializationOffset), OBJECT); + + Assert.assertEquals(0, buffer.position()); } } diff --git a/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/ORecordSerializerBinaryTest.java b/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/ORecordSerializerBinaryTest.java index 6564ac4d0b1..f05889a9d06 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/ORecordSerializerBinaryTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/ORecordSerializerBinaryTest.java @@ -43,7 +43,9 @@ import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -/** @author mdjurovi */ +/** + * @author mdjurovi + */ @RunWith(Parameterized.class) public class ORecordSerializerBinaryTest { diff --git a/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/index/OSimpleKeySerializerTest.java b/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/index/OSimpleKeySerializerTest.java index d1449562e3b..b6b1a63fa07 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/index/OSimpleKeySerializerTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/index/OSimpleKeySerializerTest.java @@ -1,27 +1,30 @@ package com.orientechnologies.orient.core.serialization.serializer.binary.impl.index; import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges; -import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree; +import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALPageChangesPortion; import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.junit.Assert; import org.junit.Before; +import org.junit.Test; public class OSimpleKeySerializerTest { + private static final int FIELD_SIZE = 9; private static final Double OBJECT = Math.PI; private OSimpleKeySerializer simpleKeySerializer; - byte[] stream = new byte[FIELD_SIZE]; @Before public void beforeClass() { - simpleKeySerializer = new OSimpleKeySerializer(); + simpleKeySerializer = new OSimpleKeySerializer<>(); } + @Test public void testFieldSize() { Assert.assertEquals(simpleKeySerializer.getObjectSize(OBJECT), FIELD_SIZE); } + @Test public void testSerializeInByteBuffer() { final int serializationOffset = 5; @@ -42,15 +45,40 @@ public void testSerializeInByteBuffer() { Assert.assertEquals(buffer.position() - serializationOffset, FIELD_SIZE); } + @Test + public void testSerializeInImmutableByteBufferPosition() { + final int serializationOffset = 5; + + final ByteBuffer buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); + buffer.position(serializationOffset); + + simpleKeySerializer.serializeInByteBufferObject(OBJECT, buffer); + + final int binarySize = buffer.position() - serializationOffset; + Assert.assertEquals(binarySize, FIELD_SIZE); + + buffer.position(0); + Assert.assertEquals( + simpleKeySerializer.getObjectSizeInByteBuffer(serializationOffset, buffer), FIELD_SIZE); + Assert.assertEquals(0, buffer.position()); + + Assert.assertEquals( + simpleKeySerializer.deserializeFromByteBufferObject(serializationOffset, buffer), OBJECT); + Assert.assertEquals(0, buffer.position()); + } + + @Test public void testSerializeWALChanges() { final int serializationOffset = 5; final ByteBuffer buffer = - ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder()); + ByteBuffer.allocateDirect( + FIELD_SIZE + serializationOffset + OWALPageChangesPortion.PORTION_BYTES) + .order(ByteOrder.nativeOrder()); final byte[] data = new byte[FIELD_SIZE]; - simpleKeySerializer.serializeNativeObject(OBJECT, data, 0); - final OWALChanges walChanges = new OWALChangesTree(); + simpleKeySerializer.serializeNativeObject(OBJECT, data, 0); + final OWALChanges walChanges = new OWALPageChangesPortion(); walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( @@ -60,5 +88,6 @@ public void testSerializeWALChanges() { simpleKeySerializer.deserializeFromByteBufferObject( buffer, walChanges, serializationOffset), OBJECT); + Assert.assertEquals(0, buffer.position()); } } diff --git a/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerRIDTest.java b/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerRIDTest.java index fc68e3aef08..efb7213e7b8 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerRIDTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerRIDTest.java @@ -4,13 +4,15 @@ import com.orientechnologies.common.serialization.types.OShortSerializer; import com.orientechnologies.orient.core.id.ORecordId; import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges; -import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree; +import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALPageChangesPortion; import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.junit.Assert; import org.junit.Before; +import org.junit.Test; public class OStreamSerializerRIDTest { + private static final int FIELD_SIZE = OShortSerializer.SHORT_SIZE + OLongSerializer.LONG_SIZE; private static final int clusterId = 5; private static final long position = 100500L; @@ -23,10 +25,12 @@ public void beforeClass() { streamSerializerRID = new OStreamSerializerRID(); } + @Test public void testFieldSize() { Assert.assertEquals(streamSerializerRID.getObjectSize(OBJECT), FIELD_SIZE); } + @Test public void testSerializeInByteBuffer() { final int serializationOffset = 5; @@ -47,15 +51,40 @@ public void testSerializeInByteBuffer() { Assert.assertEquals(buffer.position() - serializationOffset, FIELD_SIZE); } + @Test + public void testSerializeInImmutableByteBufferPosition() { + final int serializationOffset = 5; + + final ByteBuffer buffer = ByteBuffer.allocate(FIELD_SIZE + serializationOffset); + + buffer.position(serializationOffset); + streamSerializerRID.serializeInByteBufferObject(OBJECT, buffer); + + final int binarySize = buffer.position() - serializationOffset; + Assert.assertEquals(binarySize, FIELD_SIZE); + + buffer.position(0); + Assert.assertEquals( + streamSerializerRID.getObjectSizeInByteBuffer(serializationOffset, buffer), FIELD_SIZE); + Assert.assertEquals(0, buffer.position()); + + Assert.assertEquals( + streamSerializerRID.deserializeFromByteBufferObject(serializationOffset, buffer), OBJECT); + Assert.assertEquals(0, buffer.position()); + } + + @Test public void testsSerializeWALChanges() { final int serializationOffset = 5; final ByteBuffer buffer = - ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder()); + ByteBuffer.allocateDirect( + FIELD_SIZE + serializationOffset + OWALPageChangesPortion.PORTION_BYTES) + .order(ByteOrder.nativeOrder()); final byte[] data = new byte[FIELD_SIZE]; streamSerializerRID.serializeNativeObject(OBJECT, data, 0); - final OWALChanges walChanges = new OWALChangesTree(); + final OWALChanges walChanges = new OWALPageChangesPortion(); walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( diff --git a/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerSBTreeIndexRIDContainerTest.java b/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerSBTreeIndexRIDContainerTest.java index 711bafec46e..95f0b33e315 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerSBTreeIndexRIDContainerTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerSBTreeIndexRIDContainerTest.java @@ -6,7 +6,7 @@ import com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage; import com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations.OAtomicOperationsManager; import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges; -import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree; +import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALPageChangesPortion; import com.orientechnologies.orient.core.storage.ridbag.sbtree.OIndexRIDContainer; import java.io.IOException; import java.nio.ByteBuffer; @@ -18,8 +18,9 @@ import org.junit.Test; public class OStreamSerializerSBTreeIndexRIDContainerTest extends BaseMemoryInternalDatabase { - private OStreamSerializerSBTreeIndexRIDContainer streamSerializerSBTreeIndexRIDContainer = - new OStreamSerializerSBTreeIndexRIDContainer();; + + private final OStreamSerializerSBTreeIndexRIDContainer streamSerializerSBTreeIndexRIDContainer = + new OStreamSerializerSBTreeIndexRIDContainer(); @Test public void testSerializeInByteBufferEmbeddedNonDurable() throws IOException { @@ -125,6 +126,61 @@ public void testSerializeInByteBufferEmbeddedDurable() throws IOException { } } + @Test + public void testSerializeInImmutableByteBufferPositionEmbeddedDurable() throws IOException { + final OAbstractPaginatedStorage storage = (OAbstractPaginatedStorage) db.getStorage(); + final OAtomicOperationsManager atomicOperationsManager = storage.getAtomicOperationsManager(); + atomicOperationsManager.startAtomicOperation(null); + try { + + final OIndexRIDContainer indexRIDContainer = + new OIndexRIDContainer("test", true, new AtomicLong(0)); + + indexRIDContainer.setTopThreshold(100); + for (int i = 0; i < 5; i++) { + indexRIDContainer.add(new ORecordId(1, i * 2)); + } + + Assert.assertTrue(indexRIDContainer.isEmbedded()); + + final int len = streamSerializerSBTreeIndexRIDContainer.getObjectSize(indexRIDContainer); + final int serializationOffset = 5; + + final ByteBuffer buffer = ByteBuffer.allocate(len + serializationOffset); + buffer.position(serializationOffset); + + streamSerializerSBTreeIndexRIDContainer.serializeInByteBufferObject( + indexRIDContainer, buffer); + + final int binarySize = buffer.position() - serializationOffset; + Assert.assertEquals(binarySize, len); + + buffer.position(0); + Assert.assertEquals( + streamSerializerSBTreeIndexRIDContainer.getObjectSizeInByteBuffer( + serializationOffset, buffer), + len); + Assert.assertEquals(0, buffer.position()); + + OIndexRIDContainer newRidContainer = + streamSerializerSBTreeIndexRIDContainer.deserializeFromByteBufferObject( + serializationOffset, buffer); + Assert.assertEquals(0, buffer.position()); + + Assert.assertNotSame(newRidContainer, indexRIDContainer); + + Assert.assertTrue(newRidContainer.isEmbedded()); + Assert.assertTrue(newRidContainer.isDurableNonTxMode()); + + final Set storedRids = new HashSet<>(newRidContainer); + final Set newRids = new HashSet<>(indexRIDContainer); + + Assert.assertEquals(newRids, storedRids); + } finally { + atomicOperationsManager.endAtomicOperation(null); + } + } + @Test public void testSerializeInByteBufferNonEmbeddedDurable() throws IOException { final OAbstractPaginatedStorage storage = (OAbstractPaginatedStorage) db.getStorage(); @@ -177,6 +233,61 @@ public void testSerializeInByteBufferNonEmbeddedDurable() throws IOException { } } + @Test + public void testSerializeInImmutableByteBufferPositionNonEmbeddedDurable() throws IOException { + final OAbstractPaginatedStorage storage = (OAbstractPaginatedStorage) db.getStorage(); + final OAtomicOperationsManager atomicOperationsManager = storage.getAtomicOperationsManager(); + atomicOperationsManager.startAtomicOperation(null); + try { + + final OIndexRIDContainer indexRIDContainer = + new OIndexRIDContainer("test", true, new AtomicLong(0)); + + indexRIDContainer.setTopThreshold(1); + for (int i = 0; i < 5; i++) { + indexRIDContainer.add(new ORecordId(1, i * 4)); + } + + Assert.assertFalse(indexRIDContainer.isEmbedded()); + + final int len = streamSerializerSBTreeIndexRIDContainer.getObjectSize(indexRIDContainer); + final int serializationOffset = 5; + + final ByteBuffer buffer = ByteBuffer.allocate(len + serializationOffset); + buffer.position(serializationOffset); + + streamSerializerSBTreeIndexRIDContainer.serializeInByteBufferObject( + indexRIDContainer, buffer); + + final int binarySize = buffer.position() - serializationOffset; + Assert.assertEquals(binarySize, len); + + buffer.position(0); + Assert.assertEquals( + streamSerializerSBTreeIndexRIDContainer.getObjectSizeInByteBuffer( + serializationOffset, buffer), + len); + Assert.assertEquals(0, buffer.position()); + + OIndexRIDContainer newRidContainer = + streamSerializerSBTreeIndexRIDContainer.deserializeFromByteBufferObject( + serializationOffset, buffer); + Assert.assertEquals(0, buffer.position()); + + Assert.assertNotSame(newRidContainer, indexRIDContainer); + + Assert.assertFalse(newRidContainer.isEmbedded()); + Assert.assertTrue(newRidContainer.isDurableNonTxMode()); + + final Set storedRids = new HashSet<>(newRidContainer); + final Set newRids = new HashSet<>(indexRIDContainer); + + Assert.assertEquals(newRids, storedRids); + } finally { + atomicOperationsManager.endAtomicOperation(null); + } + } + @Test public void testSerializeWALChangesEmbeddedNonDurable() throws IOException { final OAbstractPaginatedStorage storage = (OAbstractPaginatedStorage) db.getStorage(); @@ -197,11 +308,13 @@ public void testSerializeWALChangesEmbeddedNonDurable() throws IOException { final int serializationOffset = 5; final ByteBuffer buffer = - ByteBuffer.allocateDirect(len + serializationOffset).order(ByteOrder.nativeOrder()); + ByteBuffer.allocateDirect( + len + serializationOffset + OWALPageChangesPortion.PORTION_BYTES) + .order(ByteOrder.nativeOrder()); final byte[] data = new byte[len]; streamSerializerSBTreeIndexRIDContainer.serializeNativeObject(indexRIDContainer, data, 0); - final OWALChanges walChanges = new OWALChangesTree(); + final OWALChanges walChanges = new OWALPageChangesPortion(); walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( @@ -211,6 +324,7 @@ public void testSerializeWALChangesEmbeddedNonDurable() throws IOException { OIndexRIDContainer newRidContainer = streamSerializerSBTreeIndexRIDContainer.deserializeFromByteBufferObject( buffer, walChanges, serializationOffset); + Assert.assertEquals(0, buffer.position()); Assert.assertNotSame(newRidContainer, indexRIDContainer); @@ -247,11 +361,13 @@ public void testSerializeWALChangesEmbeddedDurable() throws IOException { final int serializationOffset = 5; final ByteBuffer buffer = - ByteBuffer.allocateDirect(len + serializationOffset).order(ByteOrder.nativeOrder()); + ByteBuffer.allocateDirect( + len + serializationOffset + OWALPageChangesPortion.PORTION_BYTES) + .order(ByteOrder.nativeOrder()); final byte[] data = new byte[len]; streamSerializerSBTreeIndexRIDContainer.serializeNativeObject(indexRIDContainer, data, 0); - final OWALChanges walChanges = new OWALChangesTree(); + final OWALChanges walChanges = new OWALPageChangesPortion(); walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( @@ -297,11 +413,13 @@ public void testSerializeWALChangesNonEmbeddedNonDurable() throws IOException { final int serializationOffset = 5; final ByteBuffer buffer = - ByteBuffer.allocateDirect(len + serializationOffset).order(ByteOrder.nativeOrder()); + ByteBuffer.allocateDirect( + len + serializationOffset + OWALPageChangesPortion.PORTION_BYTES) + .order(ByteOrder.nativeOrder()); final byte[] data = new byte[len]; streamSerializerSBTreeIndexRIDContainer.serializeNativeObject(indexRIDContainer, data, 0); - final OWALChanges walChanges = new OWALChangesTree(); + final OWALChanges walChanges = new OWALPageChangesPortion(); walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( @@ -347,11 +465,13 @@ public void testSerializeWALChangesNonEmbeddedDurable() throws IOException { final int serializationOffset = 5; final ByteBuffer buffer = - ByteBuffer.allocateDirect(len + serializationOffset).order(ByteOrder.nativeOrder()); + ByteBuffer.allocateDirect( + len + serializationOffset + OWALPageChangesPortion.PORTION_BYTES) + .order(ByteOrder.nativeOrder()); final byte[] data = new byte[len]; streamSerializerSBTreeIndexRIDContainer.serializeNativeObject(indexRIDContainer, data, 0); - final OWALChanges walChanges = new OWALChangesTree(); + final OWALChanges walChanges = new OWALPageChangesPortion(); walChanges.setBinaryValue(buffer, data, serializationOffset); Assert.assertEquals( diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/BatchUniqueProjectionRid.java b/core/src/test/java/com/orientechnologies/orient/core/sql/BatchUniqueProjectionRid.java index d0b94e9e693..b8e1ac1a868 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/BatchUniqueProjectionRid.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/BatchUniqueProjectionRid.java @@ -15,7 +15,8 @@ public void testBatchUniqueRid() { List> res = db.command( new OCommandScript( - "begin;let $a = select \"a\" as a ; let $b = select \"a\" as b; return [$a,$b] ")) + "begin;let $a = select \"a\" as a ; let $b = select \"a\" as b; return" + + " [$a,$b] ")) .execute(); assertFalse( diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/CreateLightWeightEdgesSQLTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/CreateLightWeightEdgesSQLTest.java index 53bddd8f14e..a83b01a33b6 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/CreateLightWeightEdgesSQLTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/CreateLightWeightEdgesSQLTest.java @@ -77,7 +77,8 @@ public void mtTest() throws InterruptedException { try { session1.command( - "create edge e from (select from v where id=1) to (select from v where id=2) "); + "create edge e from (select from v where id=1) to (select from v" + + " where id=2) "); } catch (OConcurrentModificationException e) { } diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/InsertUnionValueTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/InsertUnionValueTest.java index 1a2758ac268..22efbf35ba1 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/InsertUnionValueTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/InsertUnionValueTest.java @@ -42,7 +42,8 @@ public void testUnionInsert() { + " let $b = {\"anotherKey\":\"anotherValue\"};\n" + " let $u = unionAll($a, $b); \n" + "\n" - + " /* both of the following throw the exception and require to restart the server*/\n" + + " /* both of the following throw the exception and require to restart the" + + " server*/\n" + " update $example set metadata[\"something\"] = $u;\n" + " update $example set metadata.something = $u;") .close(); diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/NestedInsertTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/NestedInsertTest.java index 5bf8b4a83bc..9a0b4b8ab3c 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/NestedInsertTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/NestedInsertTest.java @@ -19,7 +19,9 @@ public void testEmbeddedValueDate() { OResultSet result = db.command( - "insert into myClass (name,meta) values (\"claudio\",{\"@type\":\"d\",\"country\":\"italy\", \"date\":\"2013-01-01\",\"@fieldTypes\":\"date=a\"}) return @this"); + "insert into myClass (name,meta) values" + + " (\"claudio\",{\"@type\":\"d\",\"country\":\"italy\"," + + " \"date\":\"2013-01-01\",\"@fieldTypes\":\"date=a\"}) return @this"); final ODocument res = ((OIdentifiable) result.next().getProperty("@this")).getRecord(); final ODocument embedded = res.field("meta"); Assert.assertNotNull(embedded); @@ -38,7 +40,8 @@ public void testLinkedNested() { OResultSet result = db.command( - "insert into myClass set some ={\"@type\":\"d\",\"@class\":\"Linked\",\"name\":\"a name\"} return @this"); + "insert into myClass set some ={\"@type\":\"d\",\"@class\":\"Linked\",\"name\":\"a" + + " name\"} return @this"); final ODocument res = ((OIdentifiable) result.next().getProperty("@this")).getRecord(); final ODocument ln = res.field("some"); diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateClassTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateClassTest.java index f4d07b7f25c..4a3d5517ea2 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateClassTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateClassTest.java @@ -26,7 +26,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Enrico Risa */ +/** + * @author Enrico Risa + */ public class OCommandExecutorSQLCreateClassTest extends BaseMemoryDatabase { public void beforeTest() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateFunctionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateFunctionTest.java index a33ff6611ef..7da918fabde 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateFunctionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateFunctionTest.java @@ -5,13 +5,16 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OCommandExecutorSQLCreateFunctionTest extends BaseMemoryDatabase { @Test public void testCreateFunction() { db.command( - "CREATE FUNCTION testCreateFunction \"return 'hello '+name;\" PARAMETERS [name] IDEMPOTENT true LANGUAGE Javascript") + "CREATE FUNCTION testCreateFunction \"return 'hello '+name;\" PARAMETERS [name]" + + " IDEMPOTENT true LANGUAGE Javascript") .close(); OResultSet result = db.command("select testCreateFunction('world') as name"); Assert.assertEquals(result.next().getProperty("name"), "hello world"); diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreatePropertyTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreatePropertyTest.java index f902ce0aae0..bffc6e29cd8 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreatePropertyTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreatePropertyTest.java @@ -32,7 +32,9 @@ import com.orientechnologies.orient.core.sql.parser.OStatement; import org.junit.Test; -/** @author Michael MacFadden */ +/** + * @author Michael MacFadden + */ public class OCommandExecutorSQLCreatePropertyTest extends BaseMemoryInternalDatabase { private static final String PROP_NAME = "name"; @@ -215,7 +217,8 @@ public void testComplexCreateProperty() throws Exception { db.command("CREATE Class company").close(); db.command( - "CREATE Property company.officers EMBEDDEDLIST STRING (MANDATORY, READONLY, NOTNULL) UNSAFE") + "CREATE Property company.officers EMBEDDEDLIST STRING (MANDATORY, READONLY, NOTNULL)" + + " UNSAFE") .close(); OClass companyClass = db.getMetadata().getSchema().getClass("company"); @@ -299,7 +302,8 @@ public void testNonStrict() throws Exception { db.command("CREATE CLASS company").close(); db.command( - "CREATE PROPERTY company.id INTEGER (MANDATORY, NOTNULL false, READONLY true, MAX 10, MIN 4, DEFAULT 6) UNSAFE") + "CREATE PROPERTY company.id INTEGER (MANDATORY, NOTNULL false, READONLY true, MAX 10," + + " MIN 4, DEFAULT 6) UNSAFE") .close(); OClass companyClass = db.getMetadata().getSchema().getClass("company"); diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLSelectTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLSelectTest.java index 01afc9673b8..9060bb91f78 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLSelectTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLSelectTest.java @@ -72,7 +72,8 @@ public void beforeTest() { db.command("CREATE index foo_comp_osite on foo (comp, osite) NOTUNIQUE").close(); db.command( - "insert into foo (name, bar, address) values ('a', 1, {'street':'1st street', 'city':'NY', '@type':'d'})") + "insert into foo (name, bar, address) values ('a', 1, {'street':'1st street'," + + " 'city':'NY', '@type':'d'})") .close(); db.command("insert into foo (name, bar) values ('b', 2)").close(); db.command("insert into foo (name, bar) values ('c', 3)").close(); @@ -177,7 +178,8 @@ public void beforeTest() { db.command("create class OCommandExecutorSQLSelectTest_aggregations").close(); db.command( - "insert into OCommandExecutorSQLSelectTest_aggregations set data = [{\"size\": 0}, {\"size\": 0}, {\"size\": 30}, {\"size\": 50}, {\"size\": 50}]") + "insert into OCommandExecutorSQLSelectTest_aggregations set data = [{\"size\": 0}," + + " {\"size\": 0}, {\"size\": 30}, {\"size\": 50}, {\"size\": 50}]") .close(); } @@ -207,7 +209,8 @@ private static void initComplexFilterInSquareBrackets(ODatabaseDocument db) { db.command("INSERT INTO ComplexFilterInSquareBrackets1 SET name = 'n6', value = -1").close(); db.command("INSERT INTO ComplexFilterInSquareBrackets1 SET name = 'n7', value = null").close(); db.command( - "INSERT INTO ComplexFilterInSquareBrackets2 SET collection = (select from ComplexFilterInSquareBrackets1)") + "INSERT INTO ComplexFilterInSquareBrackets2 SET collection = (select from" + + " ComplexFilterInSquareBrackets1)") .close(); } @@ -252,17 +255,21 @@ private static void initLinkListSequence(ODatabaseDocument db) { db.command("insert into LinkListSequence set name = '1.2.1'").close(); db.command("insert into LinkListSequence set name = '1.2.2'").close(); db.command( - "insert into LinkListSequence set name = '1.1', children = (select from LinkListSequence where name like '1.1.%')") + "insert into LinkListSequence set name = '1.1', children = (select from" + + " LinkListSequence where name like '1.1.%')") .close(); db.command( - "insert into LinkListSequence set name = '1.2', children = (select from LinkListSequence where name like '1.2.%')") + "insert into LinkListSequence set name = '1.2', children = (select from" + + " LinkListSequence where name like '1.2.%')") .close(); db.command( - "insert into LinkListSequence set name = '1', children = (select from LinkListSequence where name in ['1.1', '1.2'])") + "insert into LinkListSequence set name = '1', children = (select from LinkListSequence" + + " where name in ['1.1', '1.2'])") .close(); db.command("insert into LinkListSequence set name = '2'").close(); db.command( - "insert into LinkListSequence set name = 'root', children = (select from LinkListSequence where name in ['1', '1'])") + "insert into LinkListSequence set name = 'root', children = (select from" + + " LinkListSequence where name in ['1', '1'])") .close(); } @@ -293,7 +300,8 @@ private static void initMassiveOrderSkipLimit(ODatabaseDocument db) { db.getMetadata().getSchema().createClass("MassiveOrderSkipLimit", 1, null); db.declareIntent(new OIntentMassiveInsert()); String fieldValue = - "laskdf lkajsd flaksjdf laksjd flakjsd flkasjd flkajsd flkajsd flkajsd flkajsd flkajsd flkjas;lkj a;ldskjf laksdj asdklasdjf lskdaj fladsd"; + "laskdf lkajsd flaksjdf laksjd flakjsd flkasjd flkajsd flkajsd flkajsd flkajsd flkajsd" + + " flkjas;lkj a;ldskjf laksdj asdklasdjf lskdaj fladsd"; for (int i = 0; i < ORDER_SKIP_LIMIT_ITEMS; i++) { ODocument doc = new ODocument("MassiveOrderSkipLimit"); doc.field("nnum", i); @@ -439,7 +447,8 @@ public void testOperatorPriority() { .collect(Collectors.toList()); List qResult8 = - db.command("select * from foo where (((name ='a' and bar = 1000)) or (name = 'b'))") + db + .command("select * from foo where (((name ='a' and bar = 1000)) or (name = 'b'))") .stream() .collect(Collectors.toList()); @@ -457,35 +466,42 @@ public void testOperatorPriority2() { List qResult = db .command( - "select * from bar where name ='a' and foo = 1 or name='b' or name='c' and foo = 3 and other = 4 or name = 'e' and foo = 5 or name = 'm' and foo > 2 ") + "select * from bar where name ='a' and foo = 1 or name='b' or name='c' and foo = 3" + + " and other = 4 or name = 'e' and foo = 5 or name = 'm' and foo > 2 ") .stream() .collect(Collectors.toList()); List qResult2 = db .command( - "select * from bar where (name ='a' and foo = 1) or name='b' or (name='c' and foo = 3 and other = 4) or (name = 'e' and foo = 5) or (name = 'm' and foo > 2)") + "select * from bar where (name ='a' and foo = 1) or name='b' or (name='c' and foo =" + + " 3 and other = 4) or (name = 'e' and foo = 5) or (name = 'm' and foo > 2)") .stream() .collect(Collectors.toList()); List qResult3 = db .command( - "select * from bar where (name ='a' and foo = 1) or (name='b') or (name='c' and foo = 3 and other = 4) or (name ='e' and foo = 5) or (name = 'm' and foo > 2)") + "select * from bar where (name ='a' and foo = 1) or (name='b') or (name='c' and foo" + + " = 3 and other = 4) or (name ='e' and foo = 5) or (name = 'm' and foo > 2)") .stream() .collect(Collectors.toList()); List qResult4 = db .command( - "select * from bar where (name ='a' and foo = 1) or ((name='b') or (name='c' and foo = 3 and other = 4)) or (name = 'e' and foo = 5) or (name = 'm' and foo > 2)") + "select * from bar where (name ='a' and foo = 1) or ((name='b') or (name='c' and" + + " foo = 3 and other = 4)) or (name = 'e' and foo = 5) or (name = 'm' and foo" + + " > 2)") .stream() .collect(Collectors.toList()); List qResult5 = db .command( - "select * from bar where (name ='a' and foo = 1) or ((name='b') or (name='c' and foo = 3 and other = 4) or (name = 'e' and foo = 5)) or (name = 'm' and foo > 2)") + "select * from bar where (name ='a' and foo = 1) or ((name='b') or (name='c' and" + + " foo = 3 and other = 4) or (name = 'e' and foo = 5)) or (name = 'm' and foo" + + " > 2)") .stream() .collect(Collectors.toList()); @@ -500,35 +516,44 @@ public void testOperatorPriority3() { List qResult = db .command( - "select * from bar where name <> 'a' and foo = 1 or name='b' or name='c' and foo = 3 and other <> 4 or name = 'e' and foo = 5 or name = 'm' and foo > 2 ") + "select * from bar where name <> 'a' and foo = 1 or name='b' or name='c' and foo =" + + " 3 and other <> 4 or name = 'e' and foo = 5 or name = 'm' and foo > 2 ") .stream() .collect(Collectors.toList()); List qResult2 = db .command( - "select * from bar where (name <> 'a' and foo = 1) or name='b' or (name='c' and foo = 3 and other <> 4) or (name = 'e' and foo = 5) or (name = 'm' and foo > 2)") + "select * from bar where (name <> 'a' and foo = 1) or name='b' or (name='c' and foo" + + " = 3 and other <> 4) or (name = 'e' and foo = 5) or (name = 'm' and foo >" + + " 2)") .stream() .collect(Collectors.toList()); List qResult3 = db .command( - "select * from bar where ( name <> 'a' and foo = 1) or (name='b') or (name='c' and foo = 3 and other <> 4) or (name ='e' and foo = 5) or (name = 'm' and foo > 2)") + "select * from bar where ( name <> 'a' and foo = 1) or (name='b') or (name='c' and" + + " foo = 3 and other <> 4) or (name ='e' and foo = 5) or (name = 'm' and foo" + + " > 2)") .stream() .collect(Collectors.toList()); List qResult4 = db .command( - "select * from bar where (name <> 'a' and foo = 1) or ( (name='b') or (name='c' and foo = 3 and other <> 4)) or (name = 'e' and foo = 5) or (name = 'm' and foo > 2)") + "select * from bar where (name <> 'a' and foo = 1) or ( (name='b') or (name='c' and" + + " foo = 3 and other <> 4)) or (name = 'e' and foo = 5) or (name = 'm' and" + + " foo > 2)") .stream() .collect(Collectors.toList()); List qResult5 = db .command( - "select * from bar where (name <> 'a' and foo = 1) or ((name='b') or (name='c' and foo = 3 and other <> 4) or (name = 'e' and foo = 5)) or (name = 'm' and foo > 2)") + "select * from bar where (name <> 'a' and foo = 1) or ((name='b') or (name='c' and" + + " foo = 3 and other <> 4) or (name = 'e' and foo = 5)) or (name = 'm' and" + + " foo > 2)") .stream() .collect(Collectors.toList()); @@ -602,7 +627,8 @@ public void testParamsInLetSubquery() { params.put("name", "foo"); OResultSet qResult = db.command( - "select from TestParams let $foo = (select name from TestParams where surname = :name) where surname in $foo.name ", + "select from TestParams let $foo = (select name from TestParams where surname = :name)" + + " where surname in $foo.name ", params); assertEquals(qResult.stream().count(), 1); } @@ -779,7 +805,9 @@ public void testMatches() { List result = db.query( new OSQLSynchQuery( - "select from foo where name matches '(?i)(^\\\\Qa\\\\E$)|(^\\\\Qname2\\\\E$)|(^\\\\Qname3\\\\E$)' and bar = 1")); + "select from foo where name matches" + + " '(?i)(^\\\\Qa\\\\E$)|(^\\\\Qname2\\\\E$)|(^\\\\Qname3\\\\E$)' and bar =" + + " 1")); assertEquals(result.size(), 1); } @@ -846,7 +874,8 @@ public void testMultipleParamsWithSameName() { qResult = db.query( - "select from TestParams where name like '%' + :param1 + '%' and surname like '%' + :param1 + '%'", + "select from TestParams where name like '%' + :param1 + '%' and surname like '%' +" + + " :param1 + '%'", params); assertEquals(qResult.stream().count(), 1); @@ -914,7 +943,10 @@ public void testLetAsListAsString() { public void testAggregations() { OSQLSynchQuery sql = new OSQLSynchQuery( - "select data.size as collection_content, data.size() as collection_size, min(data.size) as collection_min, max(data.size) as collection_max, sum(data.size) as collection_sum, avg(data.size) as collection_avg from OCommandExecutorSQLSelectTest_aggregations"); + "select data.size as collection_content, data.size() as collection_size, min(data.size)" + + " as collection_min, max(data.size) as collection_max, sum(data.size) as" + + " collection_sum, avg(data.size) as collection_avg from" + + " OCommandExecutorSQLSelectTest_aggregations"); List results = db.query(sql); assertEquals(1, results.size()); ODocument doc = results.get(0); @@ -955,7 +987,8 @@ public void testLetOrder() { try { List results = db.query(sql); fail( - "Invalid query, usage of LET, aggregate functions and GROUP BY together is not supported"); + "Invalid query, usage of LET, aggregate functions and GROUP BY together is not" + + " supported"); } catch (OCommandSQLParsingException x) { } @@ -988,7 +1021,8 @@ public void testExpandSkipLimit() { // issue #4985 OResultSet results = db.query( - "SELECT expand(linked) from ExpandSkipLimit where parent = true order by nnum skip 1 limit 1"); + "SELECT expand(linked) from ExpandSkipLimit where parent = true order by nnum skip 1" + + " limit 1"); OResult doc = results.next(); assertThat(doc.getProperty("nnum")).isEqualTo(1); } @@ -1120,7 +1154,8 @@ public void testMatchesWithQuotes2() { // issue #5229 OResultSet results = db.query( - "SELECT FROM matchesstuff WHERE (name matches '\\\\Qadm\\\\E.*' and not ( name matches '(.*)foo(.*)' ) )"); + "SELECT FROM matchesstuff WHERE (name matches '\\\\Qadm\\\\E.*' and not ( name matches" + + " '(.*)foo(.*)' ) )"); assertEquals(results.stream().count(), 1); } @@ -1130,7 +1165,8 @@ public void testMatchesWithQuotes3() { // issue #5229 OResultSet results = db.query( - "SELECT FROM matchesstuff WHERE (name matches '\\\\Qadm\\\\E.*' and ( name matches '\\\\Qadmin\\\\E.*' ) )"); + "SELECT FROM matchesstuff WHERE (name matches '\\\\Qadm\\\\E.*' and ( name matches" + + " '\\\\Qadmin\\\\E.*' ) )"); assertEquals(results.stream().count(), 1); } @@ -1198,7 +1234,8 @@ public void testLinkListSequence2() { initLinkListSequence(db); OSQLSynchQuery sql = new OSQLSynchQuery( - "select expand(children[0].children.children) from LinkListSequence where name = 'root'"); + "select expand(children[0].children.children) from LinkListSequence where name =" + + " 'root'"); List results = db.query(sql); assertEquals(results.size(), 4); for (ODocument result : results) { @@ -1285,7 +1322,8 @@ public void testComplexFilterInSquareBrackets() { } sql = - "SELECT expand(collection[name = 'n1' and not value = 1]) FROM ComplexFilterInSquareBrackets2"; + "SELECT expand(collection[name = 'n1' and not value = 1]) FROM" + + " ComplexFilterInSquareBrackets2"; results = db.query(sql).stream().collect(Collectors.toList()); assertEquals(results.size(), 0); @@ -1305,29 +1343,36 @@ public void testCollateOnCollections() { // issue #4851 db.command("create class OCommandExecutorSqlSelectTest_collateOnCollections").close(); db.command( - "create property OCommandExecutorSqlSelectTest_collateOnCollections.categories EMBEDDEDLIST string") + "create property OCommandExecutorSqlSelectTest_collateOnCollections.categories" + + " EMBEDDEDLIST string") .close(); db.command( - "insert into OCommandExecutorSqlSelectTest_collateOnCollections set categories=['a','b']") + "insert into OCommandExecutorSqlSelectTest_collateOnCollections set" + + " categories=['a','b']") .close(); db.command( - "alter property OCommandExecutorSqlSelectTest_collateOnCollections.categories COLLATE ci") + "alter property OCommandExecutorSqlSelectTest_collateOnCollections.categories COLLATE" + + " ci") .close(); db.command( - "insert into OCommandExecutorSqlSelectTest_collateOnCollections set categories=['Math','English']") + "insert into OCommandExecutorSqlSelectTest_collateOnCollections set" + + " categories=['Math','English']") .close(); db.command( - "insert into OCommandExecutorSqlSelectTest_collateOnCollections set categories=['a','b','c']") + "insert into OCommandExecutorSqlSelectTest_collateOnCollections set" + + " categories=['a','b','c']") .close(); List results = db.query( new OSQLSynchQuery( - "select from OCommandExecutorSqlSelectTest_collateOnCollections where 'Math' in categories")); + "select from OCommandExecutorSqlSelectTest_collateOnCollections where 'Math' in" + + " categories")); assertEquals(results.size(), 1); results = db.query( new OSQLSynchQuery( - "select from OCommandExecutorSqlSelectTest_collateOnCollections where 'math' in categories")); + "select from OCommandExecutorSqlSelectTest_collateOnCollections where 'math' in" + + " categories")); assertEquals(results.size(), 1); } @@ -1338,13 +1383,15 @@ public void testCountUniqueIndex() { db.command("create property OCommandExecutorSqlSelectTest_testCountUniqueIndex.AAA String") .close(); db.command( - "create index OCommandExecutorSqlSelectTest_testCountUniqueIndex.AAA on OCommandExecutorSqlSelectTest_testCountUniqueIndex(AAA) unique") + "create index OCommandExecutorSqlSelectTest_testCountUniqueIndex.AAA on" + + " OCommandExecutorSqlSelectTest_testCountUniqueIndex(AAA) unique") .close(); List results = db .query( - "select count(*) as count from OCommandExecutorSqlSelectTest_testCountUniqueIndex where AAA='missing'") + "select count(*) as count from OCommandExecutorSqlSelectTest_testCountUniqueIndex" + + " where AAA='missing'") .stream() .collect(Collectors.toList()); assertEquals(results.size(), 1); @@ -1393,7 +1440,9 @@ public void testCompositeIndexWithoutNullValues() { db.command("create property CompositeIndexWithoutNullValues.one String").close(); db.command("create property CompositeIndexWithoutNullValues.two String").close(); db.command( - "create index CompositeIndexWithoutNullValues.one_two on CompositeIndexWithoutNullValues (one, two) NOTUNIQUE METADATA {ignoreNullValues: true}") + "create index CompositeIndexWithoutNullValues.one_two on" + + " CompositeIndexWithoutNullValues (one, two) NOTUNIQUE METADATA" + + " {ignoreNullValues: true}") .close(); db.command("insert into CompositeIndexWithoutNullValues set one = 'foo'").close(); @@ -1416,7 +1465,9 @@ public void testCompositeIndexWithoutNullValues() { db.command("create property CompositeIndexWithoutNullValues2.one String").close(); db.command("create property CompositeIndexWithoutNullValues2.two String").close(); db.command( - "create index CompositeIndexWithoutNullValues2.one_two on CompositeIndexWithoutNullValues2 (one, two) NOTUNIQUE METADATA {ignoreNullValues: false}") + "create index CompositeIndexWithoutNullValues2.one_two on" + + " CompositeIndexWithoutNullValues2 (one, two) NOTUNIQUE METADATA" + + " {ignoreNullValues: false}") .close(); db.command("insert into CompositeIndexWithoutNullValues2 set one = 'foo'").close(); @@ -1552,21 +1603,26 @@ public void testCountOnSubclassIndexes() { db.command("create class testCountOnSubclassIndexes_superclass").close(); db.command("create property testCountOnSubclassIndexes_superclass.foo boolean").close(); db.command( - "create index testCountOnSubclassIndexes_superclass.foo on testCountOnSubclassIndexes_superclass (foo) notunique") + "create index testCountOnSubclassIndexes_superclass.foo on" + + " testCountOnSubclassIndexes_superclass (foo) notunique") .close(); db.command( - "create class testCountOnSubclassIndexes_sub1 extends testCountOnSubclassIndexes_superclass") + "create class testCountOnSubclassIndexes_sub1 extends" + + " testCountOnSubclassIndexes_superclass") .close(); db.command( - "create index testCountOnSubclassIndexes_sub1.foo on testCountOnSubclassIndexes_sub1 (foo) notunique") + "create index testCountOnSubclassIndexes_sub1.foo on testCountOnSubclassIndexes_sub1" + + " (foo) notunique") .close(); db.command( - "create class testCountOnSubclassIndexes_sub2 extends testCountOnSubclassIndexes_superclass") + "create class testCountOnSubclassIndexes_sub2 extends" + + " testCountOnSubclassIndexes_superclass") .close(); db.command( - "create index testCountOnSubclassIndexes_sub2.foo on testCountOnSubclassIndexes_sub2 (foo) notunique") + "create index testCountOnSubclassIndexes_sub2.foo on testCountOnSubclassIndexes_sub2" + + " (foo) notunique") .close(); db.command("insert into testCountOnSubclassIndexes_sub1 set name = 'a', foo = true").close(); @@ -1576,14 +1632,16 @@ public void testCountOnSubclassIndexes() { db.command("insert into testCountOnSubclassIndexes_sub2 set name = 'e', foo = false").close(); List results = - db.query("SELECT count(*) as count from testCountOnSubclassIndexes_sub1 where foo = true") + db + .query("SELECT count(*) as count from testCountOnSubclassIndexes_sub1 where foo = true") .stream() .collect(Collectors.toList()); assertEquals(results.size(), 1); assertEquals(results.get(0).getProperty("count"), (Object) 1L); results = - db.query("SELECT count(*) as count from testCountOnSubclassIndexes_sub2 where foo = true") + db + .query("SELECT count(*) as count from testCountOnSubclassIndexes_sub2 where foo = true") .stream() .collect(Collectors.toList()); assertEquals(results.size(), 1); @@ -1592,7 +1650,8 @@ public void testCountOnSubclassIndexes() { results = db .query( - "SELECT count(*) as count from testCountOnSubclassIndexes_superclass where foo = true") + "SELECT count(*) as count from testCountOnSubclassIndexes_superclass where foo =" + + " true") .stream() .collect(Collectors.toList()); assertEquals(results.size(), 1); @@ -1691,12 +1750,14 @@ public void testEmbeddedMapOfMapsContainsValue() { db.command( "INSERT INTO " + className - + " SET id = 0, embedded_map = {\"key_2\" : {\"name\" : \"key_2\", \"id\" : \"0\"}}") + + " SET id = 0, embedded_map = {\"key_2\" : {\"name\" : \"key_2\", \"id\" :" + + " \"0\"}}") .close(); db.command( "INSERT INTO " + className - + " SET id = 1, embedded_map = {\"key_1\" : {\"name\" : \"key_1\", \"id\" : \"1\" }}") + + " SET id = 1, embedded_map = {\"key_1\" : {\"name\" : \"key_1\", \"id\" : \"1\"" + + " }}") .close(); OResultSet results = diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLUpdateTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLUpdateTest.java index e5bd591dff2..99be4a67bc9 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLUpdateTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLUpdateTest.java @@ -69,7 +69,8 @@ public void testUpdateRemoveAll() throws Exception { assertEquals(((Set) r.getProperty("employees")).size(), 4); db.command( - "UPDATE company REMOVE employees = (SELECT FROM employee WHERE name = 'Linn') WHERE name = 'MyCompany'") + "UPDATE company REMOVE employees = (SELECT FROM employee WHERE name = 'Linn') WHERE" + + " name = 'MyCompany'") .close(); r.reload(); @@ -116,7 +117,8 @@ public void testUpdateMergeWithIndex() { assertEquals(result.stream().count(), 1); db.command( - "UPDATE i_have_a_list CONTENT {\"id\": \"the_id\", \"types\": [\"ccc\", \"bbb\"]} WHERE id = 'the_id'") + "UPDATE i_have_a_list CONTENT {\"id\": \"the_id\", \"types\": [\"ccc\", \"bbb\"]} WHERE" + + " id = 'the_id'") .close(); result = db.query("SELECT * FROM i_have_a_list WHERE types = 'ccc'"); @@ -145,18 +147,18 @@ public void testNamedParamsSyntax() { db.command( "update " + className - + " SET name = :name, full_name = :full_name, html_url = :html_url, description = :description, " - + "git_url = :git_url, ssh_url = :ssh_url, clone_url = :clone_url, svn_url = :svn_url" - + "UPSERT WHERE full_name = :full_name", + + " SET name = :name, full_name = :full_name, html_url = :html_url, description =" + + " :description, git_url = :git_url, ssh_url = :ssh_url, clone_url = :clone_url," + + " svn_url = :svn_urlUPSERT WHERE full_name = :full_name", params) .close(); db.command( "update " + className - + " SET name = :name, html_url = :html_url, description = :description, " - + "git_url = :git_url, ssh_url = :ssh_url, clone_url = :clone_url, svn_url = :svn_url" - + "UPSERT WHERE full_name = :full_name", + + " SET name = :name, html_url = :html_url, description = :description, git_url =" + + " :git_url, ssh_url = :ssh_url, clone_url = :clone_url, svn_url = :svn_urlUPSERT" + + " WHERE full_name = :full_name", params) .close(); } @@ -219,7 +221,8 @@ public void testBooleanListNamedParameter() { params.put("booleanList", booleanList); db.command( - "UPDATE test SET boolean = :boolean, booleanList = :booleanList, integerList = :integerList WHERE id = 1", + "UPDATE test SET boolean = :boolean, booleanList = :booleanList, integerList =" + + " :integerList WHERE id = 1", params) .close(); @@ -491,7 +494,8 @@ public void testLinkedUpdate() { ((ODatabaseDocumentInternal) db).getLocalCache().clear(); db.command( - "Update TestSource set flag = true , linked.flag = true return after *, linked:{*} as infoLinked where name = \"foo\"") + "Update TestSource set flag = true , linked.flag = true return after *, linked:{*} as" + + " infoLinked where name = \"foo\"") .close(); ((ODatabaseDocumentInternal) db).getLocalCache().clear(); diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/OLiveQueryTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/OLiveQueryTest.java index 15f8e3132a2..ad7175ddbd7 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/OLiveQueryTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/OLiveQueryTest.java @@ -61,7 +61,8 @@ public class OLiveQueryTest { public void before() { odb = new OrientDB("memory:", OrientDBConfig.defaultConfig()); odb.execute( - "create database OLiveQueryTest memory users ( admin identified by 'admin' role admin, reader identified by 'reader' role reader)"); + "create database OLiveQueryTest memory users ( admin identified by 'admin' role admin," + + " reader identified by 'reader' role reader)"); db = odb.open("OLiveQueryTest", "admin", "admin"); } diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/OLiveQueryV2Test.java b/core/src/test/java/com/orientechnologies/orient/core/sql/OLiveQueryV2Test.java index 8a0362fedc2..a03b1477c76 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/OLiveQueryV2Test.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/OLiveQueryV2Test.java @@ -47,7 +47,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila - at - orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila - at - orientdb.com) + */ public class OLiveQueryV2Test { class MyLiveQueryListener implements OLiveQueryResultListener { public CountDownLatch latch; diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterClassStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterClassStatementExecutionTest.java index 23749d55284..6a799e85aa4 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterClassStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterClassStatementExecutionTest.java @@ -7,7 +7,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OAlterClassStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterDatabaseStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterDatabaseStatementExecutionTest.java index 4c34cb3357a..c3851380309 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterDatabaseStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterDatabaseStatementExecutionTest.java @@ -7,7 +7,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OAlterDatabaseStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterPropertyStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterPropertyStatementExecutionTest.java index baeaa0bee09..498575d3a39 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterPropertyStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterPropertyStatementExecutionTest.java @@ -9,7 +9,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OAlterPropertyStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterRoleStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterRoleStatementExecutionTest.java index 1239d5da3b4..348b7bea260 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterRoleStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterRoleStatementExecutionTest.java @@ -7,7 +7,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OAlterRoleStatementExecutionTest extends BaseMemoryDatabase { @Test public void testAddPolicy() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterSecurityPolicyStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterSecurityPolicyStatementExecutionTest.java index 83aff97d3f4..22cd7e83f0b 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterSecurityPolicyStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterSecurityPolicyStatementExecutionTest.java @@ -8,7 +8,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OAlterSecurityPolicyStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterSequenceStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterSequenceStatementExecutionTest.java index cdf88642934..3b2439852fc 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterSequenceStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OAlterSequenceStatementExecutionTest.java @@ -6,7 +6,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OAlterSequenceStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OBeginStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OBeginStatementExecutionTest.java index d1bdabd2b26..c2245cece3b 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OBeginStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OBeginStatementExecutionTest.java @@ -6,7 +6,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OBeginStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCommandExecutorSQLCreateEdgeTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCommandExecutorSQLCreateEdgeTest.java index c87056d7075..b1d20d8e547 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCommandExecutorSQLCreateEdgeTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCommandExecutorSQLCreateEdgeTest.java @@ -10,7 +10,9 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ @RunWith(JUnit4.class) public class OCommandExecutorSQLCreateEdgeTest extends BaseMemoryDatabase { @@ -58,7 +60,8 @@ public void testSubqueryParametersBinding() throws Exception { params.put("toId", 2); db.command( - "CREATE EDGE link from (select from Owner where id = :fromId) TO (select from Owner where id = :toId) SET foo = :foo", + "CREATE EDGE link from (select from Owner where id = :fromId) TO (select from Owner" + + " where id = :toId) SET foo = :foo", params) .close(); @@ -79,7 +82,8 @@ public void testBatch() throws Exception { OResultSet edges = db.command( - "CREATE EDGE link from (select from owner where testbatch = true and id > 0) TO (select from owner where testbatch = true and id = 0) batch 10", + "CREATE EDGE link from (select from owner where testbatch = true and id > 0) TO (select" + + " from owner where testbatch = true and id = 0) batch 10", "456"); Assert.assertEquals(edges.stream().count(), 19); diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCommandExecutorSQLDeleteEdgeTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCommandExecutorSQLDeleteEdgeTest.java index 4659e3cd582..30c05932d0f 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCommandExecutorSQLDeleteEdgeTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCommandExecutorSQLDeleteEdgeTest.java @@ -15,7 +15,9 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ @RunWith(JUnit4.class) public class OCommandExecutorSQLDeleteEdgeTest extends BaseMemoryDatabase { @@ -55,7 +57,8 @@ public void testFromSelect() throws Exception { public void testFromSelectToSelect() throws Exception { OResultSet res = db.command( - "delete edge CanAccess from ( select from User where username = 'gongolo' ) to ( select from Folder where keyId = '01234567893' )"); + "delete edge CanAccess from ( select from User where username = 'gongolo' ) to ( select" + + " from Folder where keyId = '01234567893' )"); assertEquals((long) res.next().getProperty("count"), 1); assertFalse(db.query("select expand(out(CanAccess)) from " + userId1).hasNext()); } diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCommandExecutorSQLDeleteVertexTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCommandExecutorSQLDeleteVertexTest.java index b0361782359..85de837a2be 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCommandExecutorSQLDeleteVertexTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCommandExecutorSQLDeleteVertexTest.java @@ -25,7 +25,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OCommandExecutorSQLDeleteVertexTest extends BaseMemoryDatabase { public void beforeTest() { @@ -68,7 +70,8 @@ public void testDeleteVertexWithEdgeRid() throws Exception { db.command("create vertex User set name = 'foo1'").close(); db.command("create vertex User set name = 'foo2'").close(); db.command( - "create edge E from (select from user where name = 'foo1') to (select from user where name = 'foo2')") + "create edge E from (select from user where name = 'foo1') to (select from user where" + + " name = 'foo2')") .close(); try (OResultSet edges = db.query("select from e limit 1")) { db.command("delete vertex [" + edges.next().getIdentity().get() + "]").close(); diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCommitStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCommitStatementExecutionTest.java index ed8a2bfcb21..554d92bab28 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCommitStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCommitStatementExecutionTest.java @@ -6,7 +6,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OCommitStatementExecutionTest extends BaseMemoryDatabase { @Test public void testBegin() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OConsoleStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OConsoleStatementExecutionTest.java index a8f2c928284..71cadd1d0a3 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OConsoleStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OConsoleStatementExecutionTest.java @@ -5,7 +5,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OConsoleStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateClassStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateClassStatementExecutionTest.java index eb58638ce87..12e3ed1a07f 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateClassStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateClassStatementExecutionTest.java @@ -6,7 +6,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OCreateClassStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateClusterStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateClusterStatementExecutionTest.java index a7043c684a4..437289694d8 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateClusterStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateClusterStatementExecutionTest.java @@ -7,7 +7,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OCreateClusterStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateDatabaseStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateDatabaseStatementExecutionTest.java index bea41eb355c..483e6aa015e 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateDatabaseStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateDatabaseStatementExecutionTest.java @@ -9,7 +9,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OCreateDatabaseStatementExecutionTest { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateEdgeStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateEdgeStatementExecutionTest.java index 993f5184059..118d110da69 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateEdgeStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateEdgeStatementExecutionTest.java @@ -10,7 +10,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OCreateEdgeStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateFunctionStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateFunctionStatementExecutionTest.java index 7828bbf121e..107c3d5bafb 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateFunctionStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateFunctionStatementExecutionTest.java @@ -4,7 +4,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OCreateFunctionStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateIndexStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateIndexStatementExecutionTest.java index ab6fbeb0af6..2fe94261d5a 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateIndexStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateIndexStatementExecutionTest.java @@ -7,7 +7,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OCreateIndexStatementExecutionTest extends BaseMemoryInternalDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateLinkStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateLinkStatementExecutionTest.java index 8879b563866..3de9c49685e 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateLinkStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateLinkStatementExecutionTest.java @@ -5,7 +5,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OCreateLinkStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreatePropertyStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreatePropertyStatementExecutionTest.java index ae76bbd7eea..1d1e166ee7b 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreatePropertyStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreatePropertyStatementExecutionTest.java @@ -11,7 +11,9 @@ import com.orientechnologies.orient.core.metadata.schema.OType; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OCreatePropertyStatementExecutionTest extends BaseMemoryDatabase { private static final String PROP_NAME = "name"; @@ -59,7 +61,8 @@ public void testCreatePropertyWithLinkedClass() throws Exception { db.command("CREATE class testCreatePropertyWithLinkedClass_1").close(); db.command("CREATE class testCreatePropertyWithLinkedClass_2").close(); db.command( - "CREATE property testCreatePropertyWithLinkedClass_2.division LINK testCreatePropertyWithLinkedClass_1") + "CREATE property testCreatePropertyWithLinkedClass_2.division LINK" + + " testCreatePropertyWithLinkedClass_1") .close(); OClass companyClass = @@ -157,7 +160,8 @@ public void testCreateReadOnlyFalseProperty() throws Exception { public void testCreateMandatoryPropertyWithEmbeddedType() throws Exception { db.command("CREATE Class testCreateMandatoryPropertyWithEmbeddedType").close(); db.command( - "CREATE Property testCreateMandatoryPropertyWithEmbeddedType.officers EMBEDDEDLIST STRING (MANDATORY)") + "CREATE Property testCreateMandatoryPropertyWithEmbeddedType.officers EMBEDDEDLIST" + + " STRING (MANDATORY)") .close(); OClass companyClass = @@ -178,7 +182,8 @@ public void testCreateMandatoryPropertyWithEmbeddedType() throws Exception { public void testCreateUnsafePropertyWithEmbeddedType() throws Exception { db.command("CREATE Class testCreateUnsafePropertyWithEmbeddedType").close(); db.command( - "CREATE Property testCreateUnsafePropertyWithEmbeddedType.officers EMBEDDEDLIST STRING UNSAFE") + "CREATE Property testCreateUnsafePropertyWithEmbeddedType.officers EMBEDDEDLIST STRING" + + " UNSAFE") .close(); OClass companyClass = @@ -195,7 +200,8 @@ public void testCreateUnsafePropertyWithEmbeddedType() throws Exception { public void testComplexCreateProperty() throws Exception { db.command("CREATE Class testComplexCreateProperty").close(); db.command( - "CREATE Property testComplexCreateProperty.officers EMBEDDEDLIST STRING (MANDATORY, READONLY, NOTNULL) UNSAFE") + "CREATE Property testComplexCreateProperty.officers EMBEDDEDLIST STRING (MANDATORY," + + " READONLY, NOTNULL) UNSAFE") .close(); OClass companyClass = db.getMetadata().getSchema().getClass("testComplexCreateProperty"); @@ -214,7 +220,8 @@ public void testComplexCreateProperty() throws Exception { public void testLinkedTypeDefaultAndMinMaxUnsafeProperty() throws Exception { db.command("CREATE CLASS testLinkedTypeDefaultAndMinMaxUnsafeProperty").close(); db.command( - "CREATE PROPERTY testLinkedTypeDefaultAndMinMaxUnsafeProperty.id EMBEDDEDLIST Integer (DEFAULT 5, MIN 1, MAX 10) UNSAFE") + "CREATE PROPERTY testLinkedTypeDefaultAndMinMaxUnsafeProperty.id EMBEDDEDLIST Integer" + + " (DEFAULT 5, MIN 1, MAX 10) UNSAFE") .close(); OClass companyClass = @@ -237,7 +244,8 @@ public void testLinkedTypeDefaultAndMinMaxUnsafeProperty() throws Exception { public void testDefaultAndMinMaxUnsafeProperty() throws Exception { db.command("CREATE CLASS testDefaultAndMinMaxUnsafeProperty").close(); db.command( - "CREATE PROPERTY testDefaultAndMinMaxUnsafeProperty.id INTEGER (DEFAULT 5, MIN 1, MAX 10) UNSAFE") + "CREATE PROPERTY testDefaultAndMinMaxUnsafeProperty.id INTEGER (DEFAULT 5, MIN 1, MAX" + + " 10) UNSAFE") .close(); OClass companyClass = @@ -277,7 +285,8 @@ public void testExtraSpaces() throws Exception { public void testInvalidAttributeName() throws Exception { db.command("CREATE CLASS OCommandExecutionException").close(); db.command( - "CREATE PROPERTY OCommandExecutionException.id INTEGER (MANDATORY, INVALID, NOTNULL) UNSAFE") + "CREATE PROPERTY OCommandExecutionException.id INTEGER (MANDATORY, INVALID, NOTNULL) " + + " UNSAFE") .close(); } @@ -292,7 +301,8 @@ public void testMandatoryAsLinkedName() throws Exception { db.command("CREATE CLASS testMandatoryAsLinkedName").close(); db.command("CREATE CLASS testMandatoryAsLinkedName_2").close(); db.command( - "CREATE PROPERTY testMandatoryAsLinkedName.id EMBEDDEDLIST testMandatoryAsLinkedName_2 UNSAFE") + "CREATE PROPERTY testMandatoryAsLinkedName.id EMBEDDEDLIST testMandatoryAsLinkedName_2" + + " UNSAFE") .close(); OClass companyClass = db.getMetadata().getSchema().getClass("testMandatoryAsLinkedName"); diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateSecurityPolicyStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateSecurityPolicyStatementExecutionTest.java index 19b5e3a6612..b3ec56fd388 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateSecurityPolicyStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateSecurityPolicyStatementExecutionTest.java @@ -7,7 +7,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OCreateSecurityPolicyStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateSequenceStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateSequenceStatementExecutionTest.java index 5bd8f67fa4f..8cd767aee97 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateSequenceStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateSequenceStatementExecutionTest.java @@ -6,7 +6,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OCreateSequenceStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateUserStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateUserStatementExecutionTest.java index 531044645aa..7be7eeab72f 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateUserStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateUserStatementExecutionTest.java @@ -5,7 +5,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OCreateUserStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateVertexStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateVertexStatementExecutionTest.java index b8169f80621..ab06731c39e 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateVertexStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateVertexStatementExecutionTest.java @@ -10,7 +10,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OCreateVertexStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateViewStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateViewStatementExecutionTest.java index ea1923ef52e..ec6f2950341 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateViewStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OCreateViewStatementExecutionTest.java @@ -17,7 +17,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OCreateViewStatementExecutionTest extends BaseMemoryDatabase { @Test @@ -151,7 +153,8 @@ public void testCollectionIndexes() throws InterruptedException { String statement = "CREATE VIEW " + viewName + " FROM (SELECT FROM " + className + ") METADATA {"; statement += - "indexes: [{type:'NOTUNIQUE', properties:{name:'STRING'}},{type:'NOTUNIQUE', properties:{data:{type:'EMBEDDEDLIST',linkedType:'INTEGER'}}}]"; + "indexes: [{type:'NOTUNIQUE', properties:{name:'STRING'}},{type:'NOTUNIQUE'," + + " properties:{data:{type:'EMBEDDEDLIST',linkedType:'INTEGER'}}}]"; statement += "}"; db.command(statement); diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODeleteEdgeStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODeleteEdgeStatementExecutionTest.java index 7dc8e4d5f0f..31fbc0a677d 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODeleteEdgeStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODeleteEdgeStatementExecutionTest.java @@ -5,7 +5,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class ODeleteEdgeStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODeleteStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODeleteStatementExecutionTest.java index b55de95cdb6..3e82d266c00 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODeleteStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODeleteStatementExecutionTest.java @@ -9,7 +9,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class ODeleteStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODeleteVertexStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODeleteVertexStatementExecutionTest.java index ea0c6bdd781..ccc317b113f 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODeleteVertexStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODeleteVertexStatementExecutionTest.java @@ -5,7 +5,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class ODeleteVertexStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropClassStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropClassStatementExecutionTest.java index 35f099e1e37..86b02180f34 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropClassStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropClassStatementExecutionTest.java @@ -7,7 +7,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class ODropClassStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropClusterStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropClusterStatementExecutionTest.java index 6b73ac62ed1..5845a139255 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropClusterStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropClusterStatementExecutionTest.java @@ -5,7 +5,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class ODropClusterStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropDatabaseStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropDatabaseStatementExecutionTest.java index a86e71d812e..2394c465ea8 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropDatabaseStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropDatabaseStatementExecutionTest.java @@ -8,7 +8,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class ODropDatabaseStatementExecutionTest { @Test public void testPlain() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropIndexStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropIndexStatementExecutionTest.java index 05fed920697..d80b375c742 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropIndexStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropIndexStatementExecutionTest.java @@ -8,7 +8,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class ODropIndexStatementExecutionTest extends BaseMemoryInternalDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropPropertyStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropPropertyStatementExecutionTest.java index a53008be584..a3fcd72b27a 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropPropertyStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropPropertyStatementExecutionTest.java @@ -8,7 +8,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class ODropPropertyStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropSequenceStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropSequenceStatementExecutionTest.java index 6982b71748b..0476c2936d9 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropSequenceStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropSequenceStatementExecutionTest.java @@ -8,7 +8,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class ODropSequenceStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropUserStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropUserStatementExecutionTest.java index 9dd5f40d412..7bf31f21cae 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropUserStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropUserStatementExecutionTest.java @@ -5,7 +5,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class ODropUserStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropViewStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropViewStatementExecutionTest.java index 086a609b8ff..f1dcbc47451 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropViewStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ODropViewStatementExecutionTest.java @@ -5,7 +5,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class ODropViewStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OExplainStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OExplainStatementExecutionTest.java index ca22052b9a4..5e3420de0e8 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OExplainStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OExplainStatementExecutionTest.java @@ -5,7 +5,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OExplainStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OFindReferencesStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OFindReferencesStatementExecutionTest.java index a7b2a00e8d7..dff9c31b73c 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OFindReferencesStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OFindReferencesStatementExecutionTest.java @@ -10,7 +10,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OFindReferencesStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OForEachBlockExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OForEachBlockExecutionTest.java index 4b964820530..ec22ff38e60 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OForEachBlockExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OForEachBlockExecutionTest.java @@ -4,7 +4,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OForEachBlockExecutionTest extends BaseMemoryDatabase { @Test public void testPlain() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OGrantStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OGrantStatementExecutionTest.java index 5574f9392b1..dfe731b593b 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OGrantStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OGrantStatementExecutionTest.java @@ -10,7 +10,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OGrantStatementExecutionTest extends BaseMemoryDatabase { @Test public void testSimple() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OIfStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OIfStatementExecutionTest.java index e0058d48b8d..a80efb3f5a2 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OIfStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OIfStatementExecutionTest.java @@ -6,7 +6,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OIfStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OInsertStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OInsertStatementExecutionTest.java index 11e9e6689a7..ba7fed9079b 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OInsertStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OInsertStatementExecutionTest.java @@ -17,7 +17,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OInsertStatementExecutionTest extends BaseMemoryDatabase { @Test @@ -236,7 +238,8 @@ public void testContentMultiple() { db.command( "insert into " + className - + " content {'name':'name1', 'surname':'surname1'},{'name':'name1', 'surname':'surname1'}"); + + " content {'name':'name1', 'surname':'surname1'},{'name':'name1'," + + " 'surname':'surname1'}"); printExecutionPlan(result); for (int i = 0; i < 2; i++) { Assert.assertTrue(result.hasNext()); diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OMatchStatementExecutionNewTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OMatchStatementExecutionNewTest.java index c7ed0815dd8..e7886b607be 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OMatchStatementExecutionNewTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OMatchStatementExecutionNewTest.java @@ -40,7 +40,8 @@ public void beforeTest() { for (String[] pair : friendList) { db.command( - "CREATE EDGE Friend from (select from Person where name = ?) to (select from Person where name = ?)", + "CREATE EDGE Friend from (select from Person where name = ?) to (select from Person where" + + " name = ?)", pair[0], pair[1]); } @@ -72,7 +73,8 @@ private void initEdgeIndexTest() { for (int i = 0; i < 100; i++) { String cmd = - "CREATE EDGE IndexedEDGE FROM (SELECT FROM IndexedVertex WHERE uid = 0) TO (SELECT FROM IndexedVertex WHERE uid > " + "CREATE EDGE IndexedEDGE FROM (SELECT FROM IndexedVertex WHERE uid = 0) TO (SELECT FROM" + + " IndexedVertex WHERE uid > " + (i * nodes / 100) + " and uid <" + ((i + 1) * nodes / 100) @@ -219,7 +221,8 @@ private void initTriangleTest() { }; for (int[] edge : edges) { db.command( - "CREATE EDGE TriangleE from (select from TriangleV where uid = ?) to (select from TriangleV where uid = ?)", + "CREATE EDGE TriangleE from (select from TriangleV where uid = ?) to (select from" + + " TriangleV where uid = ?)", edge[0], edge[1]) .close(); @@ -235,7 +238,8 @@ private void initDiamondTest() { int[][] edges = {{0, 1}, {0, 2}, {1, 3}, {2, 3}}; for (int[] edge : edges) { db.command( - "CREATE EDGE DiamondE from (select from DiamondV where uid = ?) to (select from DiamondV where uid = ?)", + "CREATE EDGE DiamondE from (select from DiamondV where uid = ?) to (select from" + + " DiamondV where uid = ?)", edge[0], edge[1]) .close(); @@ -280,7 +284,8 @@ public void testSimpleWhere() throws Exception { public void testSimpleLimit() throws Exception { OResultSet qResult = db.query( - "match {class:Person, as: person, where: (name = 'n1' or name = 'n2')} return person limit 1"); + "match {class:Person, as: person, where: (name = 'n1' or name = 'n2')} return person" + + " limit 1"); Assert.assertTrue(qResult.hasNext()); qResult.next(); Assert.assertFalse(qResult.hasNext()); @@ -291,7 +296,8 @@ public void testSimpleLimit() throws Exception { public void testSimpleLimit2() throws Exception { OResultSet qResult = db.query( - "match {class:Person, as: person, where: (name = 'n1' or name = 'n2')} return person limit -1"); + "match {class:Person, as: person, where: (name = 'n1' or name = 'n2')} return person" + + " limit -1"); for (int i = 0; i < 2; i++) { Assert.assertTrue(qResult.hasNext()); qResult.next(); @@ -304,7 +310,8 @@ public void testSimpleLimit3() throws Exception { OResultSet qResult = db.query( - "match {class:Person, as: person, where: (name = 'n1' or name = 'n2')} return person limit 3"); + "match {class:Person, as: person, where: (name = 'n1' or name = 'n2')} return person" + + " limit 3"); for (int i = 0; i < 2; i++) { Assert.assertTrue(qResult.hasNext()); qResult.next(); @@ -338,7 +345,9 @@ public void testCommonFriends() throws Exception { OResultSet qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name = 'n4')} return friend)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name =" + + " 'n4')} return friend)"); printExecutionPlan(qResult); Assert.assertTrue(qResult.hasNext()); OResult item = qResult.next(); @@ -352,7 +361,9 @@ public void testCommonFriendsPatterns() throws Exception { OResultSet qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name = 'n4')} return $patterns)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name =" + + " 'n4')} return $patterns)"); printExecutionPlan(qResult); Assert.assertTrue(qResult.hasNext()); OResult item = qResult.next(); @@ -365,7 +376,9 @@ public void testCommonFriendsPatterns() throws Exception { public void testPattens() throws Exception { OResultSet qResult = db.query( - "match {class:Person, where:(name = 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name = 'n4')} return $patterns"); + "match {class:Person, where:(name =" + + " 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name =" + + " 'n4')} return $patterns"); printExecutionPlan(qResult); Assert.assertTrue(qResult.hasNext()); OResult item = qResult.next(); @@ -379,7 +392,9 @@ public void testPattens() throws Exception { public void testPaths() throws Exception { OResultSet qResult = db.query( - "match {class:Person, where:(name = 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name = 'n4')} return $paths"); + "match {class:Person, where:(name =" + + " 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name =" + + " 'n4')} return $paths"); printExecutionPlan(qResult); Assert.assertTrue(qResult.hasNext()); OResult item = qResult.next(); @@ -392,7 +407,9 @@ public void testPaths() throws Exception { public void testElements() throws Exception { OResultSet qResult = db.query( - "match {class:Person, where:(name = 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name = 'n4')} return $elements"); + "match {class:Person, where:(name =" + + " 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name =" + + " 'n4')} return $elements"); printExecutionPlan(qResult); Assert.assertTrue(qResult.hasNext()); OResult item = qResult.next(); @@ -405,7 +422,9 @@ public void testElements() throws Exception { public void testPathElements() throws Exception { OResultSet qResult = db.query( - "match {class:Person, where:(name = 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name = 'n4')} return $pathElements"); + "match {class:Person, where:(name =" + + " 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name =" + + " 'n4')} return $pathElements"); printExecutionPlan(qResult); Set expected = new HashSet<>(); expected.add("n1"); @@ -426,7 +445,9 @@ public void testCommonFriendsMatches() throws Exception { OResultSet qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name = 'n4')} return $matches)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name =" + + " 'n4')} return $matches)"); printExecutionPlan(qResult); Assert.assertTrue(qResult.hasNext()); OResult item = qResult.next(); @@ -440,7 +461,9 @@ public void testCommonFriendsArrows() throws Exception { OResultSet qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend-{as:friend}-Friend-{class: Person, where:(name = 'n4')} return friend)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend-{as:friend}-Friend-{class: Person, where:(name = 'n4')} return" + + " friend)"); printExecutionPlan(qResult); Assert.assertTrue(qResult.hasNext()); OResult item = qResult.next(); @@ -454,7 +477,9 @@ public void testCommonFriendsArrowsPatterns() throws Exception { OResultSet qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend-{as:friend}-Friend-{class: Person, where:(name = 'n4')} return $patterns)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend-{as:friend}-Friend-{class: Person, where:(name = 'n4')} return" + + " $patterns)"); printExecutionPlan(qResult); Assert.assertTrue(qResult.hasNext()); OResult item = qResult.next(); @@ -468,7 +493,9 @@ public void testCommonFriends2() throws Exception { OResultSet qResult = db.query( - "match {class:Person, where:(name = 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name = 'n4')} return friend.name as name"); + "match {class:Person, where:(name =" + + " 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name =" + + " 'n4')} return friend.name as name"); Assert.assertTrue(qResult.hasNext()); OResult item = qResult.next(); @@ -482,7 +509,8 @@ public void testCommonFriends2Arrows() throws Exception { OResultSet qResult = db.query( - "match {class:Person, where:(name = 'n1')}-Friend-{as:friend}-Friend-{class: Person, where:(name = 'n4')} return friend.name as name"); + "match {class:Person, where:(name = 'n1')}-Friend-{as:friend}-Friend-{class: Person," + + " where:(name = 'n4')} return friend.name as name"); Assert.assertTrue(qResult.hasNext()); OResult item = qResult.next(); @@ -495,7 +523,9 @@ public void testCommonFriends2Arrows() throws Exception { public void testReturnMethod() throws Exception { OResultSet qResult = db.query( - "match {class:Person, where:(name = 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name = 'n4')} return friend.name.toUpperCase(Locale.ENGLISH) as name"); + "match {class:Person, where:(name =" + + " 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name =" + + " 'n4')} return friend.name.toUpperCase(Locale.ENGLISH) as name"); Assert.assertTrue(qResult.hasNext()); OResult item = qResult.next(); Assert.assertEquals("N2", item.getProperty("name")); @@ -507,7 +537,8 @@ public void testReturnMethod() throws Exception { public void testReturnMethodArrows() throws Exception { OResultSet qResult = db.query( - "match {class:Person, where:(name = 'n1')}-Friend-{as:friend}-Friend-{class: Person, where:(name = 'n4')} return friend.name.toUpperCase(Locale.ENGLISH) as name"); + "match {class:Person, where:(name = 'n1')}-Friend-{as:friend}-Friend-{class: Person," + + " where:(name = 'n4')} return friend.name.toUpperCase(Locale.ENGLISH) as name"); Assert.assertTrue(qResult.hasNext()); OResult item = qResult.next(); Assert.assertEquals("N2", item.getProperty("name")); @@ -519,7 +550,9 @@ public void testReturnMethodArrows() throws Exception { public void testReturnExpression() throws Exception { OResultSet qResult = db.query( - "match {class:Person, where:(name = 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name = 'n4')} return friend.name + ' ' +friend.name as name"); + "match {class:Person, where:(name =" + + " 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name =" + + " 'n4')} return friend.name + ' ' +friend.name as name"); Assert.assertTrue(qResult.hasNext()); OResult item = qResult.next(); @@ -532,7 +565,8 @@ public void testReturnExpression() throws Exception { public void testReturnExpressionArrows() throws Exception { OResultSet qResult = db.query( - "match {class:Person, where:(name = 'n1')}-Friend-{as:friend}-Friend-{class: Person, where:(name = 'n4')} return friend.name + ' ' +friend.name as name"); + "match {class:Person, where:(name = 'n1')}-Friend-{as:friend}-Friend-{class: Person," + + " where:(name = 'n4')} return friend.name + ' ' +friend.name as name"); Assert.assertTrue(qResult.hasNext()); OResult item = qResult.next(); @@ -545,7 +579,9 @@ public void testReturnExpressionArrows() throws Exception { public void testReturnDefaultAlias() throws Exception { OResultSet qResult = db.query( - "match {class:Person, where:(name = 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name = 'n4')} return friend.name"); + "match {class:Person, where:(name =" + + " 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name =" + + " 'n4')} return friend.name"); Assert.assertTrue(qResult.hasNext()); OResult item = qResult.next(); @@ -558,7 +594,8 @@ public void testReturnDefaultAlias() throws Exception { public void testReturnDefaultAliasArrows() throws Exception { OResultSet qResult = db.query( - "match {class:Person, where:(name = 'n1')}-Friend-{as:friend}-Friend-{class: Person, where:(name = 'n4')} return friend.name"); + "match {class:Person, where:(name = 'n1')}-Friend-{as:friend}-Friend-{class: Person," + + " where:(name = 'n4')} return friend.name"); Assert.assertTrue(qResult.hasNext()); OResult item = qResult.next(); @@ -571,7 +608,8 @@ public void testReturnDefaultAliasArrows() throws Exception { public void testFriendsOfFriends() throws Exception { OResultSet qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend').out('Friend'){as:friend} return $matches)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend').out('Friend'){as:friend} return $matches)"); printExecutionPlan(qResult); Assert.assertTrue(qResult.hasNext()); @@ -585,7 +623,8 @@ public void testFriendsOfFriends() throws Exception { public void testFriendsOfFriendsArrows() throws Exception { OResultSet qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend->{}-Friend->{as:friend} return $matches)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend->{}-Friend->{as:friend} return $matches)"); Assert.assertTrue(qResult.hasNext()); OResult item = qResult.next(); @@ -598,7 +637,9 @@ public void testFriendsOfFriendsArrows() throws Exception { public void testFriendsOfFriends2() throws Exception { OResultSet qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1'), as: me}.both('Friend').both('Friend'){as:friend, where: ($matched.me != $currentMatch)} return $matches)"); + "select friend.name as name from (match {class:Person, where:(name = 'n1'), as:" + + " me}.both('Friend').both('Friend'){as:friend, where: ($matched.me !=" + + " $currentMatch)} return $matches)"); printExecutionPlan(qResult); Assert.assertTrue(qResult.hasNext()); @@ -612,7 +653,9 @@ public void testFriendsOfFriends2() throws Exception { public void testFriendsOfFriends2Arrows() throws Exception { OResultSet qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1'), as: me}-Friend-{}-Friend-{as:friend, where: ($matched.me != $currentMatch)} return $matches)"); + "select friend.name as name from (match {class:Person, where:(name = 'n1'), as:" + + " me}-Friend-{}-Friend-{as:friend, where: ($matched.me != $currentMatch)} return" + + " $matches)"); Assert.assertTrue(qResult.hasNext()); while (qResult.hasNext()) { @@ -625,7 +668,9 @@ public void testFriendsOfFriends2Arrows() throws Exception { public void testFriendsWithName() throws Exception { OResultSet qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1' and 1 + 1 = 2)}.out('Friend'){as:friend, where:(name = 'n2' and 1 + 1 = 2)} return friend)"); + "select friend.name as name from (match {class:Person, where:(name = 'n1' and 1 + 1 =" + + " 2)}.out('Friend'){as:friend, where:(name = 'n2' and 1 + 1 = 2)} return" + + " friend)"); Assert.assertTrue(qResult.hasNext()); Assert.assertEquals("n2", qResult.next().getProperty("name")); @@ -637,7 +682,8 @@ public void testFriendsWithName() throws Exception { public void testFriendsWithNameArrows() throws Exception { OResultSet qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1' and 1 + 1 = 2)}-Friend->{as:friend, where:(name = 'n2' and 1 + 1 = 2)} return friend)"); + "select friend.name as name from (match {class:Person, where:(name = 'n1' and 1 + 1 =" + + " 2)}-Friend->{as:friend, where:(name = 'n2' and 1 + 1 = 2)} return friend)"); Assert.assertTrue(qResult.hasNext()); Assert.assertEquals("n2", qResult.next().getProperty("name")); Assert.assertFalse(qResult.hasNext()); @@ -649,37 +695,45 @@ public void testWhile() throws Exception { OResultSet qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend'){as:friend, while: ($depth < 1)} return friend)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend'){as:friend, while: ($depth < 1)} return friend)"); Assert.assertEquals(3, size(qResult)); qResult.close(); qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend'){as:friend, while: ($depth < 2), where: ($depth=1) } return friend)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend'){as:friend, while: ($depth < 2), where: ($depth=1) } return" + + " friend)"); Assert.assertEquals(2, size(qResult)); qResult.close(); qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend'){as:friend, while: ($depth < 4), where: ($depth=1) } return friend)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend'){as:friend, while: ($depth < 4), where: ($depth=1) } return" + + " friend)"); Assert.assertEquals(2, size(qResult)); qResult.close(); qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend'){as:friend, while: (true) } return friend)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend'){as:friend, while: (true) } return friend)"); Assert.assertEquals(6, size(qResult)); qResult.close(); qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend'){as:friend, while: (true) } return friend limit 3)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend'){as:friend, while: (true) } return friend limit 3)"); Assert.assertEquals(3, size(qResult)); qResult.close(); qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend'){as:friend, while: (true) } return friend) limit 3"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend'){as:friend, while: (true) } return friend) limit 3"); Assert.assertEquals(3, size(qResult)); qResult.close(); } @@ -697,25 +751,31 @@ private int size(OResultSet qResult) { public void testWhileArrows() throws Exception { OResultSet qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend->{as:friend, while: ($depth < 1)} return friend)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend->{as:friend, while: ($depth < 1)} return friend)"); Assert.assertEquals(3, size(qResult)); qResult.close(); qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend->{as:friend, while: ($depth < 2), where: ($depth=1) } return friend)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend->{as:friend, while: ($depth < 2), where: ($depth=1) } return" + + " friend)"); Assert.assertEquals(2, size(qResult)); qResult.close(); qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend->{as:friend, while: ($depth < 4), where: ($depth=1) } return friend)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend->{as:friend, while: ($depth < 4), where: ($depth=1) } return" + + " friend)"); Assert.assertEquals(2, size(qResult)); qResult.close(); qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend->{as:friend, while: (true) } return friend)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend->{as:friend, while: (true) } return friend)"); Assert.assertEquals(6, size(qResult)); qResult.close(); } @@ -724,25 +784,31 @@ public void testWhileArrows() throws Exception { public void testMaxDepth() throws Exception { OResultSet qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend'){as:friend, maxDepth: 1, where: ($depth=1) } return friend)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend'){as:friend, maxDepth: 1, where: ($depth=1) } return" + + " friend)"); Assert.assertEquals(2, size(qResult)); qResult.close(); qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend'){as:friend, maxDepth: 1 } return friend)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend'){as:friend, maxDepth: 1 } return friend)"); Assert.assertEquals(3, size(qResult)); qResult.close(); qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend'){as:friend, maxDepth: 0 } return friend)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend'){as:friend, maxDepth: 0 } return friend)"); Assert.assertEquals(1, size(qResult)); qResult.close(); qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend'){as:friend, maxDepth: 1, where: ($depth > 0) } return friend)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend'){as:friend, maxDepth: 1, where: ($depth > 0) } return" + + " friend)"); Assert.assertEquals(2, size(qResult)); qResult.close(); } @@ -751,25 +817,29 @@ public void testMaxDepth() throws Exception { public void testMaxDepthArrow() throws Exception { OResultSet qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend->{as:friend, maxDepth: 1, where: ($depth=1) } return friend)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend->{as:friend, maxDepth: 1, where: ($depth=1) } return friend)"); Assert.assertEquals(2, size(qResult)); qResult.close(); qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend->{as:friend, maxDepth: 1 } return friend)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend->{as:friend, maxDepth: 1 } return friend)"); Assert.assertEquals(3, size(qResult)); qResult.close(); qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend->{as:friend, maxDepth: 0 } return friend)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend->{as:friend, maxDepth: 0 } return friend)"); Assert.assertEquals(1, size(qResult)); qResult.close(); qResult = db.query( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend->{as:friend, maxDepth: 1, where: ($depth > 0) } return friend)"); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend->{as:friend, maxDepth: 1, where: ($depth > 0) } return friend)"); Assert.assertEquals(2, size(qResult)); qResult.close(); } @@ -1100,7 +1170,8 @@ public void testTriangle1Arrows() { StringBuilder query = new StringBuilder(); query.append("match "); query.append( - "{class:TriangleV, as: friend1, where: (uid = 0)} -TriangleE-> {as: friend2} -TriangleE-> {as: friend3},"); + "{class:TriangleV, as: friend1, where: (uid = 0)} -TriangleE-> {as: friend2} -TriangleE->" + + " {as: friend3},"); query.append("{class:TriangleV, as: friend1} -TriangleE-> {as: friend3}"); query.append("return $matches"); @@ -1677,7 +1748,8 @@ public void testManagedPathElements() { public void testOptional() throws Exception { OResultSet qResult = db.query( - "match {class:Person, as: person} -NonExistingEdge-> {as:b, optional:true} return person, b.name"); + "match {class:Person, as: person} -NonExistingEdge-> {as:b, optional:true} return" + + " person, b.name"); printExecutionPlan(qResult); for (int i = 0; i < 6; i++) { @@ -1695,7 +1767,8 @@ public void testOptional() throws Exception { public void testOptional2() throws Exception { OResultSet qResult = db.query( - "match {class:Person, as: person} --> {as:b, optional:true, where:(nonExisting = 12)} return person, b.name"); + "match {class:Person, as: person} --> {as:b, optional:true, where:(nonExisting = 12)}" + + " return person, b.name"); for (int i = 0; i < 6; i++) { Assert.assertTrue(qResult.hasNext()); @@ -1712,11 +1785,10 @@ public void testOptional2() throws Exception { public void testOptional3() throws Exception { OResultSet qResult = db.query( - "select friend.name as name, b from (" - + "match {class:Person, as:a, where:(name = 'n1' and 1 + 1 = 2)}.out('Friend'){as:friend, where:(name = 'n2' and 1 + 1 = 2)}," - + "{as:a}.out(){as:b, where:(nonExisting = 12), optional:true}," - + "{as:friend}.out(){as:b, optional:true}" - + " return friend, b)"); + "select friend.name as name, b from (match {class:Person, as:a, where:(name = 'n1' and" + + " 1 + 1 = 2)}.out('Friend'){as:friend, where:(name = 'n2' and 1 + 1 =" + + " 2)},{as:a}.out(){as:b, where:(nonExisting = 12)," + + " optional:true},{as:friend}.out(){as:b, optional:true} return friend, b)"); printExecutionPlan(qResult); Assert.assertTrue(qResult.hasNext()); @@ -1966,7 +2038,8 @@ public void testDepthAlias() { String query = "MATCH { class: " + clazz - + ", as:a, where:(name = 'aaa')} --> {as:b, while:($depth<10), depthAlias: xy} RETURN a.name as name, b.name as bname, xy"; + + ", as:a, where:(name = 'aaa')} --> {as:b, while:($depth<10), depthAlias: xy} RETURN" + + " a.name as name, b.name as bname, xy"; OResultSet result = db.query(query); @@ -2036,7 +2109,8 @@ public void testPathAlias() { String query = "MATCH { class: " + clazz - + ", as:a, where:(name = 'aaa')} --> {as:b, while:($depth<10), pathAlias: xy} RETURN a.name as name, b.name as bname, xy"; + + ", as:a, where:(name = 'aaa')} --> {as:b, while:($depth<10), pathAlias: xy} RETURN" + + " a.name as name, b.name as bname, xy"; OResultSet result = db.query(query); diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OMatchStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OMatchStatementExecutionTest.java index 608a4e889f3..959cd0db0e9 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OMatchStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OMatchStatementExecutionTest.java @@ -45,7 +45,8 @@ public void beforeTest() { for (String[] pair : friendList) { db.command( - "CREATE EDGE Friend from (select from Person where name = ?) to (select from Person where name = ?)", + "CREATE EDGE Friend from (select from Person where name = ?) to (select from Person" + + " where name = ?)", pair[0], pair[1]) .close(); @@ -83,7 +84,8 @@ private void initEdgeIndexTest() { for (int i = 0; i < 100; i++) { db.command( - "CREATE EDGE IndexedEDGE FROM (SELECT FROM IndexedVertex WHERE uid = 0) TO (SELECT FROM IndexedVertex WHERE uid > " + "CREATE EDGE IndexedEDGE FROM (SELECT FROM IndexedVertex WHERE uid = 0) TO (SELECT" + + " FROM IndexedVertex WHERE uid > " + (i * nodes / 100) + " and uid <" + ((i + 1) * nodes / 100) @@ -228,7 +230,8 @@ private void initTriangleTest() { }; for (int[] edge : edges) { db.command( - "CREATE EDGE TriangleE from (select from TriangleV where uid = ?) to (select from TriangleV where uid = ?)", + "CREATE EDGE TriangleE from (select from TriangleV where uid = ?) to (select from" + + " TriangleV where uid = ?)", edge[0], edge[1]) .close(); @@ -246,7 +249,8 @@ private void initDiamondTest() { int[][] edges = {{0, 1}, {0, 2}, {1, 3}, {2, 3}}; for (int[] edge : edges) { db.command( - "CREATE EDGE DiamondE from (select from DiamondV where uid = ?) to (select from DiamondV where uid = ?)", + "CREATE EDGE DiamondE from (select from DiamondV where uid = ?) to (select from" + + " DiamondV where uid = ?)", edge[0], edge[1]) .close(); @@ -272,7 +276,8 @@ public void testSimpleWhere() throws Exception { List qResult = collect( db.command( - "match {class:Person, as: person, where: (name = 'n1' or name = 'n2')} return person")); + "match {class:Person, as: person, where: (name = 'n1' or name = 'n2')} return" + + " person")); assertEquals(2, qResult.size()); for (ODocument doc : qResult) { @@ -289,7 +294,8 @@ public void testSimpleLimit() throws Exception { List qResult = collect( db.command( - "match {class:Person, as: person, where: (name = 'n1' or name = 'n2')} return person limit 1")); + "match {class:Person, as: person, where: (name = 'n1' or name = 'n2')} return" + + " person limit 1")); assertEquals(1, qResult.size()); } @@ -299,7 +305,8 @@ public void testSimpleLimit2() throws Exception { List qResult = collect( db.command( - "match {class:Person, as: person, where: (name = 'n1' or name = 'n2')} return person limit -1")); + "match {class:Person, as: person, where: (name = 'n1' or name = 'n2')} return" + + " person limit -1")); assertEquals(2, qResult.size()); } @@ -309,7 +316,8 @@ public void testSimpleLimit3() throws Exception { List qResult = collect( db.command( - "match {class:Person, as: person, where: (name = 'n1' or name = 'n2')} return person limit 3")); + "match {class:Person, as: person, where: (name = 'n1' or name = 'n2')} return" + + " person limit 3")); assertEquals(2, qResult.size()); } @@ -339,7 +347,9 @@ public void testCommonFriends() throws Exception { List qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name = 'n4')} return $matches)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name" + + " = 'n4')} return $matches)")); assertEquals(1, qResult.size()); assertEquals("n2", qResult.get(0).field("name")); } @@ -350,7 +360,9 @@ public void testCommonFriendsArrows() throws Exception { List qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend-{as:friend}-Friend-{class: Person, where:(name = 'n4')} return $matches)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend-{as:friend}-Friend-{class: Person, where:(name = 'n4')}" + + " return $matches)")); assertEquals(1, qResult.size()); assertEquals("n2", qResult.get(0).field("name")); } @@ -361,7 +373,9 @@ public void testCommonFriends2() throws Exception { List qResult = collect( db.command( - "match {class:Person, where:(name = 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name = 'n4')} return friend.name as name")); + "match {class:Person, where:(name =" + + " 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name" + + " = 'n4')} return friend.name as name")); assertEquals(1, qResult.size()); assertEquals("n2", qResult.get(0).field("name")); } @@ -372,7 +386,8 @@ public void testCommonFriends2Arrows() throws Exception { List qResult = collect( db.command( - "match {class:Person, where:(name = 'n1')}-Friend-{as:friend}-Friend-{class: Person, where:(name = 'n4')} return friend.name as name")); + "match {class:Person, where:(name = 'n1')}-Friend-{as:friend}-Friend-{class:" + + " Person, where:(name = 'n4')} return friend.name as name")); assertEquals(1, qResult.size()); assertEquals("n2", qResult.get(0).field("name")); } @@ -382,7 +397,9 @@ public void testReturnMethod() throws Exception { List qResult = collect( db.command( - "match {class:Person, where:(name = 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name = 'n4')} return friend.name.toUpperCase(Locale.ENGLISH) as name")); + "match {class:Person, where:(name =" + + " 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name" + + " = 'n4')} return friend.name.toUpperCase(Locale.ENGLISH) as name")); assertEquals(1, qResult.size()); assertEquals("N2", qResult.get(0).field("name")); } @@ -392,7 +409,9 @@ public void testReturnMethodArrows() throws Exception { List qResult = collect( db.command( - "match {class:Person, where:(name = 'n1')}-Friend-{as:friend}-Friend-{class: Person, where:(name = 'n4')} return friend.name.toUpperCase(Locale.ENGLISH) as name")); + "match {class:Person, where:(name = 'n1')}-Friend-{as:friend}-Friend-{class:" + + " Person, where:(name = 'n4')} return friend.name.toUpperCase(Locale.ENGLISH)" + + " as name")); assertEquals(1, qResult.size()); assertEquals("N2", qResult.get(0).field("name")); } @@ -402,7 +421,9 @@ public void testReturnExpression() throws Exception { List qResult = collect( db.command( - "match {class:Person, where:(name = 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name = 'n4')} return friend.name + ' ' +friend.name as name")); + "match {class:Person, where:(name =" + + " 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name" + + " = 'n4')} return friend.name + ' ' +friend.name as name")); assertEquals(1, qResult.size()); assertEquals("n2 n2", qResult.get(0).field("name")); } @@ -412,7 +433,9 @@ public void testReturnExpressionArrows() throws Exception { List qResult = collect( db.command( - "match {class:Person, where:(name = 'n1')}-Friend-{as:friend}-Friend-{class: Person, where:(name = 'n4')} return friend.name + ' ' +friend.name as name")); + "match {class:Person, where:(name = 'n1')}-Friend-{as:friend}-Friend-{class:" + + " Person, where:(name = 'n4')} return friend.name + ' ' +friend.name as" + + " name")); assertEquals(1, qResult.size()); assertEquals("n2 n2", qResult.get(0).field("name")); } @@ -422,7 +445,9 @@ public void testReturnDefaultAlias() throws Exception { List qResult = collect( db.command( - "match {class:Person, where:(name = 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name = 'n4')} return friend.name")); + "match {class:Person, where:(name =" + + " 'n1')}.both('Friend'){as:friend}.both('Friend'){class: Person, where:(name" + + " = 'n4')} return friend.name")); assertEquals(1, qResult.size()); assertEquals("n2", qResult.get(0).getProperty("friend.name")); } @@ -432,7 +457,8 @@ public void testReturnDefaultAliasArrows() throws Exception { List qResult = collect( db.command( - "match {class:Person, where:(name = 'n1')}-Friend-{as:friend}-Friend-{class: Person, where:(name = 'n4')} return friend.name")); + "match {class:Person, where:(name = 'n1')}-Friend-{as:friend}-Friend-{class:" + + " Person, where:(name = 'n4')} return friend.name")); assertEquals(1, qResult.size()); assertEquals("n2", qResult.get(0).getProperty("friend.name")); } @@ -443,7 +469,8 @@ public void testFriendsOfFriends() throws Exception { List qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend').out('Friend'){as:friend} return $matches)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend').out('Friend'){as:friend} return $matches)")); assertEquals(1, qResult.size()); assertEquals("n4", qResult.get(0).field("name")); } @@ -454,7 +481,8 @@ public void testFriendsOfFriendsArrows() throws Exception { List qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend->{}-Friend->{as:friend} return $matches)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend->{}-Friend->{as:friend} return $matches)")); assertEquals(1, qResult.size()); assertEquals("n4", qResult.get(0).field("name")); } @@ -465,7 +493,9 @@ public void testFriendsOfFriends2() throws Exception { List qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1'), as: me}.both('Friend').both('Friend'){as:friend, where: ($matched.me != $currentMatch)} return $matches)")); + "select friend.name as name from (match {class:Person, where:(name = 'n1'), as:" + + " me}.both('Friend').both('Friend'){as:friend, where: ($matched.me !=" + + " $currentMatch)} return $matches)")); for (ODocument doc : qResult) { assertNotEquals(doc.field("name"), "n1"); @@ -478,7 +508,9 @@ public void testFriendsOfFriends2Arrows() throws Exception { List qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1'), as: me}-Friend-{}-Friend-{as:friend, where: ($matched.me != $currentMatch)} return $matches)")); + "select friend.name as name from (match {class:Person, where:(name = 'n1'), as:" + + " me}-Friend-{}-Friend-{as:friend, where: ($matched.me != $currentMatch)}" + + " return $matches)")); for (ODocument doc : qResult) { assertNotEquals(doc.field("name"), "n1"); @@ -491,7 +523,9 @@ public void testFriendsWithName() throws Exception { List qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1' and 1 + 1 = 2)}.out('Friend'){as:friend, where:(name = 'n2' and 1 + 1 = 2)} return friend)")); + "select friend.name as name from (match {class:Person, where:(name = 'n1' and 1 + 1" + + " = 2)}.out('Friend'){as:friend, where:(name = 'n2' and 1 + 1 = 2)} return" + + " friend)")); assertEquals(1, qResult.size()); assertEquals("n2", qResult.get(0).field("name")); } @@ -502,7 +536,9 @@ public void testFriendsWithNameArrows() throws Exception { List qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1' and 1 + 1 = 2)}-Friend->{as:friend, where:(name = 'n2' and 1 + 1 = 2)} return friend)")); + "select friend.name as name from (match {class:Person, where:(name = 'n1' and 1 + 1" + + " = 2)}-Friend->{as:friend, where:(name = 'n2' and 1 + 1 = 2)} return" + + " friend)")); assertEquals(1, qResult.size()); assertEquals("n2", qResult.get(0).field("name")); } @@ -513,37 +549,45 @@ public void testWhile() throws Exception { List qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend'){as:friend, while: ($depth < 1)} return friend)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend'){as:friend, while: ($depth < 1)} return friend)")); assertEquals(3, qResult.size()); qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend'){as:friend, while: ($depth < 2), where: ($depth=1) } return friend)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend'){as:friend, while: ($depth < 2), where: ($depth=1) }" + + " return friend)")); assertEquals(2, qResult.size()); qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend'){as:friend, while: ($depth < 4), where: ($depth=1) } return friend)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend'){as:friend, while: ($depth < 4), where: ($depth=1) }" + + " return friend)")); assertEquals(2, qResult.size()); qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend'){as:friend, while: (true) } return friend)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend'){as:friend, while: (true) } return friend)")); assertEquals(6, qResult.size()); qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend'){as:friend, while: (true) } return friend limit 3)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend'){as:friend, while: (true) } return friend limit 3)")); assertEquals(3, qResult.size()); qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend'){as:friend, while: (true) } return friend) limit 3")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend'){as:friend, while: (true) } return friend) limit 3")); assertEquals(3, qResult.size()); } @@ -553,25 +597,31 @@ public void testWhileArrows() throws Exception { List qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend->{as:friend, while: ($depth < 1)} return friend)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend->{as:friend, while: ($depth < 1)} return friend)")); assertEquals(3, qResult.size()); qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend->{as:friend, while: ($depth < 2), where: ($depth=1) } return friend)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend->{as:friend, while: ($depth < 2), where: ($depth=1) } return" + + " friend)")); assertEquals(2, qResult.size()); qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend->{as:friend, while: ($depth < 4), where: ($depth=1) } return friend)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend->{as:friend, while: ($depth < 4), where: ($depth=1) } return" + + " friend)")); assertEquals(2, qResult.size()); qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend->{as:friend, while: (true) } return friend)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend->{as:friend, while: (true) } return friend)")); assertEquals(6, qResult.size()); } @@ -580,25 +630,31 @@ public void testMaxDepth() throws Exception { List qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend'){as:friend, maxDepth: 1, where: ($depth=1) } return friend)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend'){as:friend, maxDepth: 1, where: ($depth=1) } return" + + " friend)")); assertEquals(2, qResult.size()); qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend'){as:friend, maxDepth: 1 } return friend)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend'){as:friend, maxDepth: 1 } return friend)")); assertEquals(3, qResult.size()); qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend'){as:friend, maxDepth: 0 } return friend)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend'){as:friend, maxDepth: 0 } return friend)")); assertEquals(1, qResult.size()); qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}.out('Friend'){as:friend, maxDepth: 1, where: ($depth > 0) } return friend)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}.out('Friend'){as:friend, maxDepth: 1, where: ($depth > 0) } return" + + " friend)")); assertEquals(2, qResult.size()); } @@ -607,25 +663,31 @@ public void testMaxDepthArrow() throws Exception { List qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend->{as:friend, maxDepth: 1, where: ($depth=1) } return friend)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend->{as:friend, maxDepth: 1, where: ($depth=1) } return" + + " friend)")); assertEquals(2, qResult.size()); qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend->{as:friend, maxDepth: 1 } return friend)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend->{as:friend, maxDepth: 1 } return friend)")); assertEquals(3, qResult.size()); qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend->{as:friend, maxDepth: 0 } return friend)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend->{as:friend, maxDepth: 0 } return friend)")); assertEquals(1, qResult.size()); qResult = collect( db.command( - "select friend.name as name from (match {class:Person, where:(name = 'n1')}-Friend->{as:friend, maxDepth: 1, where: ($depth > 0) } return friend)")); + "select friend.name as name from (match {class:Person, where:(name =" + + " 'n1')}-Friend->{as:friend, maxDepth: 1, where: ($depth > 0) } return" + + " friend)")); assertEquals(2, qResult.size()); } @@ -910,7 +972,8 @@ public void testTriangle1Arrows() { StringBuilder query = new StringBuilder(); query.append("match "); query.append( - "{class:TriangleV, as: friend1, where: (uid = 0)} -TriangleE-> {as: friend2} -TriangleE-> {as: friend3},"); + "{class:TriangleV, as: friend1, where: (uid = 0)} -TriangleE-> {as: friend2} -TriangleE->" + + " {as: friend3},"); query.append("{class:TriangleV, as: friend1} -TriangleE-> {as: friend3}"); query.append("return $matches"); @@ -1324,7 +1387,8 @@ public void testOptional() throws Exception { List qResult = collect( db.command( - "match {class:Person, as: person} -NonExistingEdge-> {as:b, optional:true} return person, b.name")); + "match {class:Person, as: person} -NonExistingEdge-> {as:b, optional:true} return" + + " person, b.name")); assertEquals(6, qResult.size()); for (ODocument doc : qResult) { assertTrue(doc.fieldNames().length == 2); @@ -1340,7 +1404,8 @@ public void testOptional2() throws Exception { List qResult = collect( db.command( - "match {class:Person, as: person} --> {as:b, optional:true, where:(nonExisting = 12)} return person, b.name")); + "match {class:Person, as: person} --> {as:b, optional:true, where:(nonExisting =" + + " 12)} return person, b.name")); assertEquals(6, qResult.size()); for (ODocument doc : qResult) { assertTrue(doc.fieldNames().length == 2); @@ -1356,11 +1421,10 @@ public void testOptional3() throws Exception { List qResult = collect( db.command( - "select friend.name as name from (" - + "match {class:Person, as:a, where:(name = 'n1' and 1 + 1 = 2)}.out('Friend'){as:friend, where:(name = 'n2' and 1 + 1 = 2)}," - + "{as:a}.out(){as:b, where:(nonExisting = 12), optional:true}," - + "{as:friend}.out(){as:b, optional:true}" - + " return friend)")); + "select friend.name as name from (match {class:Person, as:a, where:(name = 'n1' and" + + " 1 + 1 = 2)}.out('Friend'){as:friend, where:(name = 'n2' and 1 + 1 =" + + " 2)},{as:a}.out(){as:b, where:(nonExisting = 12)," + + " optional:true},{as:friend}.out(){as:b, optional:true} return friend)")); assertEquals(1, qResult.size()); assertEquals("n2", qResult.get(0).field("name")); } @@ -1387,7 +1451,8 @@ public void testEvalInReturn() { List qResult = collect( db.command( - "MATCH {class: testEvalInReturn, as: p} RETURN if(eval(\"p.name = 'foo'\"), 1, 2) AS b")); + "MATCH {class: testEvalInReturn, as: p} RETURN if(eval(\"p.name = 'foo'\"), 1, 2)" + + " AS b")); assertEquals(2, qResult.size()); int sum = 0; @@ -1399,7 +1464,8 @@ public void testEvalInReturn() { qResult = collect( db.command( - "MATCH {class: testEvalInReturn, as: p} RETURN if(eval(\"p.name = 'foo'\"), 'foo', 'foo') AS b")); + "MATCH {class: testEvalInReturn, as: p} RETURN if(eval(\"p.name = 'foo'\"), 'foo'," + + " 'foo') AS b")); assertEquals(2, qResult.size()); } @@ -1417,16 +1483,19 @@ public void testCheckClassAsCondition() { db.command("CREATE VERTEX testCheckClassAsCondition2 SET name = 'baz'").close(); } db.command( - "CREATE EDGE E FROM (select from testCheckClassAsCondition where name = 'foo') to (select from testCheckClassAsCondition1)") + "CREATE EDGE E FROM (select from testCheckClassAsCondition where name = 'foo') to" + + " (select from testCheckClassAsCondition1)") .close(); db.command( - "CREATE EDGE E FROM (select from testCheckClassAsCondition where name = 'foo') to (select from testCheckClassAsCondition2)") + "CREATE EDGE E FROM (select from testCheckClassAsCondition where name = 'foo') to" + + " (select from testCheckClassAsCondition2)") .close(); List qResult = collect( db.command( - "MATCH {class: testCheckClassAsCondition, as: p} -E- {class: testCheckClassAsCondition1, as: q} RETURN $elements")); + "MATCH {class: testCheckClassAsCondition, as: p} -E- {class:" + + " testCheckClassAsCondition1, as: q} RETURN $elements")); assertEquals(2, qResult.size()); } @@ -1437,37 +1506,44 @@ public void testInstanceof() { List qResult = collect( db.command( - "MATCH {class: Person, as: p, where: ($currentMatch instanceof 'Person')} return $elements limit 1")); + "MATCH {class: Person, as: p, where: ($currentMatch instanceof 'Person')} return" + + " $elements limit 1")); assertEquals(1, qResult.size()); qResult = collect( db.command( - "MATCH {class: Person, as: p, where: ($currentMatch instanceof 'V')} return $elements limit 1")); + "MATCH {class: Person, as: p, where: ($currentMatch instanceof 'V')} return" + + " $elements limit 1")); assertEquals(1, qResult.size()); qResult = collect( db.command( - "MATCH {class: Person, as: p, where: (not ($currentMatch instanceof 'Person'))} return $elements limit 1")); + "MATCH {class: Person, as: p, where: (not ($currentMatch instanceof 'Person'))}" + + " return $elements limit 1")); assertEquals(0, qResult.size()); qResult = collect( db.command( - "MATCH {class: Person, where: (name = 'n1')}.out(){as:p, where: ($currentMatch instanceof 'Person')} return $elements limit 1")); + "MATCH {class: Person, where: (name = 'n1')}.out(){as:p, where: ($currentMatch" + + " instanceof 'Person')} return $elements limit 1")); assertEquals(1, qResult.size()); qResult = collect( db.command( - "MATCH {class: Person, where: (name = 'n1')}.out(){as:p, where: ($currentMatch instanceof 'Person' and '$currentMatch' <> '@this')} return $elements limit 1")); + "MATCH {class: Person, where: (name = 'n1')}.out(){as:p, where: ($currentMatch" + + " instanceof 'Person' and '$currentMatch' <> '@this')} return $elements limit" + + " 1")); assertEquals(1, qResult.size()); qResult = collect( db.command( - "MATCH {class: Person, where: (name = 'n1')}.out(){as:p, where: ( not ($currentMatch instanceof 'Person'))} return $elements limit 1")); + "MATCH {class: Person, where: (name = 'n1')}.out(){as:p, where: ( not" + + " ($currentMatch instanceof 'Person'))} return $elements limit 1")); assertEquals(0, qResult.size()); } @@ -1492,7 +1568,8 @@ public void testBigEntryPoint() { List qResult = collect( db.command( - "MATCH {class: testBigEntryPoint1, as: a}, {class: testBigEntryPoint2, as: b} return $elements limit 1")); + "MATCH {class: testBigEntryPoint1, as: a}, {class: testBigEntryPoint2, as: b}" + + " return $elements limit 1")); assertEquals(1, qResult.size()); } @@ -1513,13 +1590,16 @@ public void testMatched1() { db.command("CREATE VERTEX testMatched1_Far SET name = 'far'").close(); db.command( - "CREATE EDGE testMatched1_Foo_Bar FROM (SELECT FROM testMatched1_Foo) TO (SELECT FROM testMatched1_Bar)") + "CREATE EDGE testMatched1_Foo_Bar FROM (SELECT FROM testMatched1_Foo) TO (SELECT FROM" + + " testMatched1_Bar)") .close(); db.command( - "CREATE EDGE testMatched1_Bar_Baz FROM (SELECT FROM testMatched1_Bar) TO (SELECT FROM testMatched1_Baz)") + "CREATE EDGE testMatched1_Bar_Baz FROM (SELECT FROM testMatched1_Bar) TO (SELECT FROM" + + " testMatched1_Baz)") .close(); db.command( - "CREATE EDGE testMatched1_Foo_Far FROM (SELECT FROM testMatched1_Foo) TO (SELECT FROM testMatched1_Far)") + "CREATE EDGE testMatched1_Foo_Far FROM (SELECT FROM testMatched1_Foo) TO (SELECT FROM" + + " testMatched1_Far)") .close(); OResultSet result = @@ -1527,7 +1607,8 @@ public void testMatched1() { "MATCH \n" + "{class: testMatched1_Foo, as: foo}.out('testMatched1_Foo_Bar') {as: bar}, \n" + "{class: testMatched1_Bar,as: bar}.out('testMatched1_Bar_Baz') {as: baz}, \n" - + "{class: testMatched1_Foo,as: foo}.out('testMatched1_Foo_Far') {where: ($matched.baz IS null),as: far}\n" + + "{class: testMatched1_Foo,as: foo}.out('testMatched1_Foo_Far') {where:" + + " ($matched.baz IS null),as: far}\n" + "RETURN $matches"); assertFalse(result.hasNext()); @@ -1536,7 +1617,8 @@ public void testMatched1() { "MATCH \n" + "{class: testMatched1_Foo, as: foo}.out('testMatched1_Foo_Bar') {as: bar}, \n" + "{class: testMatched1_Bar,as: bar}.out('testMatched1_Bar_Baz') {as: baz}, \n" - + "{class: testMatched1_Foo,as: foo}.out('testMatched1_Foo_Far') {where: ($matched.baz IS not null),as: far}\n" + + "{class: testMatched1_Foo,as: foo}.out('testMatched1_Foo_Far') {where:" + + " ($matched.baz IS not null),as: far}\n" + "RETURN $matches"); assertEquals(1, result.stream().count()); } @@ -1558,16 +1640,16 @@ public void testDependencyOrdering1() { db.command("CREATE VERTEX testDependencyOrdering1_Far SET name = 'far'").close(); db.command( - "CREATE EDGE testDependencyOrdering1_Foo_Bar FROM (" - + "SELECT FROM testDependencyOrdering1_Foo) TO (SELECT FROM testDependencyOrdering1_Bar)") + "CREATE EDGE testDependencyOrdering1_Foo_Bar FROM (SELECT FROM" + + " testDependencyOrdering1_Foo) TO (SELECT FROM testDependencyOrdering1_Bar)") .close(); db.command( - "CREATE EDGE testDependencyOrdering1_Bar_Baz FROM (" - + "SELECT FROM testDependencyOrdering1_Bar) TO (SELECT FROM testDependencyOrdering1_Baz)") + "CREATE EDGE testDependencyOrdering1_Bar_Baz FROM (SELECT FROM" + + " testDependencyOrdering1_Bar) TO (SELECT FROM testDependencyOrdering1_Baz)") .close(); db.command( - "CREATE EDGE testDependencyOrdering1_Foo_Far FROM (" - + "SELECT FROM testDependencyOrdering1_Foo) TO (SELECT FROM testDependencyOrdering1_Far)") + "CREATE EDGE testDependencyOrdering1_Foo_Far FROM (SELECT FROM" + + " testDependencyOrdering1_Foo) TO (SELECT FROM testDependencyOrdering1_Far)") .close(); // The correct but non-obvious execution order here is: @@ -1613,16 +1695,16 @@ public void testCircularDependency() { db.command("CREATE VERTEX testCircularDependency_Far SET name = 'far'").close(); db.command( - "CREATE EDGE testCircularDependency_Foo_Bar FROM (" - + "SELECT FROM testCircularDependency_Foo) TO (SELECT FROM testCircularDependency_Bar)") + "CREATE EDGE testCircularDependency_Foo_Bar FROM (SELECT FROM" + + " testCircularDependency_Foo) TO (SELECT FROM testCircularDependency_Bar)") .close(); db.command( - "CREATE EDGE testCircularDependency_Bar_Baz FROM (" - + "SELECT FROM testCircularDependency_Bar) TO (SELECT FROM testCircularDependency_Baz)") + "CREATE EDGE testCircularDependency_Bar_Baz FROM (SELECT FROM" + + " testCircularDependency_Bar) TO (SELECT FROM testCircularDependency_Baz)") .close(); db.command( - "CREATE EDGE testCircularDependency_Foo_Far FROM (" - + "SELECT FROM testCircularDependency_Foo) TO (SELECT FROM testCircularDependency_Far)") + "CREATE EDGE testCircularDependency_Foo_Far FROM (SELECT FROM" + + " testCircularDependency_Foo) TO (SELECT FROM testCircularDependency_Far)") .close(); // The circular dependency here is: @@ -1666,8 +1748,9 @@ public void testUndefinedAliasDependency() { db.command("CREATE VERTEX testUndefinedAliasDependency_Bar SET name = 'bar'").close(); db.command( - "CREATE EDGE testUndefinedAliasDependency_Foo_Bar FROM (" - + "SELECT FROM testUndefinedAliasDependency_Foo) TO (SELECT FROM testUndefinedAliasDependency_Bar)") + "CREATE EDGE testUndefinedAliasDependency_Foo_Bar FROM (SELECT FROM" + + " testUndefinedAliasDependency_Foo) TO (SELECT FROM" + + " testUndefinedAliasDependency_Bar)") .close(); // "bar" in the following query declares a dependency on the alias "baz", which doesn't exist. @@ -1702,23 +1785,23 @@ public void testCyclicDeepTraversal() { // a -> b -> z // z -> c -> a db.command( - "CREATE EDGE testCyclicDeepTraversalE from" - + "(select from testCyclicDeepTraversalV where name = 'a') to (select from testCyclicDeepTraversalV where name = 'b')") + "CREATE EDGE testCyclicDeepTraversalE from(select from testCyclicDeepTraversalV where" + + " name = 'a') to (select from testCyclicDeepTraversalV where name = 'b')") .close(); db.command( - "CREATE EDGE testCyclicDeepTraversalE from" - + "(select from testCyclicDeepTraversalV where name = 'b') to (select from testCyclicDeepTraversalV where name = 'z')") + "CREATE EDGE testCyclicDeepTraversalE from(select from testCyclicDeepTraversalV where" + + " name = 'b') to (select from testCyclicDeepTraversalV where name = 'z')") .close(); db.command( - "CREATE EDGE testCyclicDeepTraversalE from" - + "(select from testCyclicDeepTraversalV where name = 'z') to (select from testCyclicDeepTraversalV where name = 'c')") + "CREATE EDGE testCyclicDeepTraversalE from(select from testCyclicDeepTraversalV where" + + " name = 'z') to (select from testCyclicDeepTraversalV where name = 'c')") .close(); db.command( - "CREATE EDGE testCyclicDeepTraversalE from" - + "(select from testCyclicDeepTraversalV where name = 'c') to (select from testCyclicDeepTraversalV where name = 'a')") + "CREATE EDGE testCyclicDeepTraversalE from(select from testCyclicDeepTraversalV where" + + " name = 'c') to (select from testCyclicDeepTraversalV where name = 'a')") .close(); String query = diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OMoveVertexStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OMoveVertexStatementExecutionTest.java index ece9c1b1671..45c62fab6da 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OMoveVertexStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OMoveVertexStatementExecutionTest.java @@ -10,7 +10,9 @@ import org.junit.Test; import org.junit.rules.TestName; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OMoveVertexStatementExecutionTest { @Rule public TestName name = new TestName(); diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OOptimizeDatabaseExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OOptimizeDatabaseExecutionTest.java index feb905c7479..cea85621097 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OOptimizeDatabaseExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OOptimizeDatabaseExecutionTest.java @@ -6,7 +6,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OOptimizeDatabaseExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OProfileStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OProfileStatementExecutionTest.java index d2527e00fa9..6f07cca3e72 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OProfileStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OProfileStatementExecutionTest.java @@ -4,7 +4,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OProfileStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ORebuildIndexStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ORebuildIndexStatementExecutionTest.java index dcc76e1217a..6555aef2410 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ORebuildIndexStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ORebuildIndexStatementExecutionTest.java @@ -11,7 +11,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila */ +/** + * @author Luigi Dell'Aquila + */ public class ORebuildIndexStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ORevokeStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ORevokeStatementExecutionTest.java index 3a91ac928be..5e45f2aaed2 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ORevokeStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ORevokeStatementExecutionTest.java @@ -17,7 +17,9 @@ import org.junit.BeforeClass; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class ORevokeStatementExecutionTest { static OrientDB orient; private ODatabaseSession db; diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ORollbackStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ORollbackStatementExecutionTest.java index 6af6783b9f1..48a3c429f4a 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ORollbackStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/ORollbackStatementExecutionTest.java @@ -6,7 +6,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class ORollbackStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OScriptExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OScriptExecutionTest.java index 032d2adc867..0949db02bc4 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OScriptExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OScriptExecutionTest.java @@ -7,7 +7,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OScriptExecutionTest extends BaseMemoryDatabase { @Test @@ -103,7 +105,8 @@ public void testReturnInIf3() { public void testLazyExecutionPlanning() { String script = ""; script += - "LET $1 = SELECT FROM (select expand(classes) from metadata:schema) where name = 'nonExistingClass';"; + "LET $1 = SELECT FROM (select expand(classes) from metadata:schema) where name =" + + " 'nonExistingClass';"; script += "IF($1.size() > 0) {"; script += " SELECT FROM nonExistingClass;"; script += " RETURN 'FAIL';"; @@ -298,9 +301,11 @@ public void testAssignOnEdgeCreate() { script += "insert into V set name = 'd', PrimaryName = 'foo4';\n"; script += - "create edge E from (select from V where name = 'a') to (select from V where name = 'b');\n"; + "create edge E from (select from V where name = 'a') to (select from V where name =" + + " 'b');\n"; script += - "create edge E from (select from V where name = 'c') to (select from V where name = 'd');\n"; + "create edge E from (select from V where name = 'c') to (select from V where name =" + + " 'd');\n"; script += "begin;\n"; script += "LET SourceDataset = SELECT expand(out()) from V where name = 'a';\n"; @@ -308,7 +313,8 @@ public void testAssignOnEdgeCreate() { script += "IF ($SourceDataset[0] != $TarDataset[0])\n"; script += "{\n"; script += - "CREATE EDGE IndirectEdge FROM $SourceDataset To $TarDataset SET Source = $SourceDataset[0].PrimaryName;\n"; + "CREATE EDGE IndirectEdge FROM $SourceDataset To $TarDataset SET Source =" + + " $SourceDataset[0].PrimaryName;\n"; script += "};\n"; script += "commit retry 10;\n"; diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OSelectStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OSelectStatementExecutionTest.java index 577b5caa9da..4300a85ecef 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OSelectStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OSelectStatementExecutionTest.java @@ -37,7 +37,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OSelectStatementExecutionTest extends BaseMemoryDatabase { @Test @@ -71,7 +73,8 @@ public void testGroupByCount() { final OResultSet result = db.query( - "select address, count(*) as occurrencies from InputTx where address is not null group by address limit 10"); + "select address, count(*) as occurrencies from InputTx where address is not null group" + + " by address limit 10"); while (result.hasNext()) { final OResult row = result.next(); Assert.assertNotNull(row.getProperty("address")); // <== FALSE! @@ -1310,7 +1313,8 @@ public void testFetchFromClassWithIndexes4() { db.query( "select from " + className - + " where foo < 100 and ((name = 'name2' and foo < 20) or surname = 'surname3') and ( 4<5 and foo < 50)"); + + " where foo < 100 and ((name = 'name2' and foo < 20) or surname = 'surname3') and" + + " ( 4<5 and foo < 50)"); printExecutionPlan(result); Assert.assertTrue(result.hasNext()); @@ -1616,7 +1620,8 @@ public void testFetchFromClassWithIndexes15() { db.query( "select from " + className - + " where name > 'name6' and name = 'name3' and surname > 'surname2' and surname < 'surname5' "); + + " where name > 'name6' and name = 'name3' and surname > 'surname2' and surname <" + + " 'surname5' "); printExecutionPlan(result); Assert.assertFalse(result.hasNext()); OSelectExecutionPlan plan = (OSelectExecutionPlan) result.getExecutionPlan().get(); @@ -4447,12 +4452,14 @@ public void testIndexWithSubquery() { db.command( "insert into " + classNamePrefix - + "Report content {format:\"PDF\", id:\"rep1\", label:\"Report 1\", source:\"Report1.src\"};") + + "Report content {format:\"PDF\", id:\"rep1\", label:\"Report 1\"," + + " source:\"Report1.src\"};") .close(); db.command( "insert into " + classNamePrefix - + "Report content {format:\"CSV\", id:\"rep2\", label:\"Report 2\", source:\"Report2.src\"};") + + "Report content {format:\"CSV\", id:\"rep2\", label:\"Report 2\"," + + " source:\"Report2.src\"};") .close(); db.command( "create edge " diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OSleepStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OSleepStatementExecutionTest.java index 73eebbf2b14..b8ebb9384b1 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OSleepStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OSleepStatementExecutionTest.java @@ -6,7 +6,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OSleepStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OTraverseStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OTraverseStatementExecutionTest.java index 0482e98aa32..16a3a618a5a 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OTraverseStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OTraverseStatementExecutionTest.java @@ -5,7 +5,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OTraverseStatementExecutionTest extends BaseMemoryDatabase { @Test @@ -241,11 +243,15 @@ public void testTraverseInBatchTx() { script += "begin;"; script += "insert into testTraverseInBatchTx_V(name) values ('a'), ('b'), ('c');"; script += - "create edge testTraverseInBatchTx_E from (select from testTraverseInBatchTx_V where name = 'a') to (select from testTraverseInBatchTx_V where name = 'b');"; + "create edge testTraverseInBatchTx_E from (select from testTraverseInBatchTx_V where name =" + + " 'a') to (select from testTraverseInBatchTx_V where name = 'b');"; script += - "create edge testTraverseInBatchTx_E from (select from testTraverseInBatchTx_V where name = 'b') to (select from testTraverseInBatchTx_V where name = 'c');"; + "create edge testTraverseInBatchTx_E from (select from testTraverseInBatchTx_V where name =" + + " 'b') to (select from testTraverseInBatchTx_V where name = 'c');"; script += - "let top = (select * from (traverse in('testTraverseInBatchTx_E') from (select from testTraverseInBatchTx_V where name='c')) where in('testTraverseInBatchTx_E').size() == 0);"; + "let top = (select * from (traverse in('testTraverseInBatchTx_E') from (select from" + + " testTraverseInBatchTx_V where name='c')) where in('testTraverseInBatchTx_E').size()" + + " == 0);"; script += "commit;"; script += "return $top"; diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OTruncateClassStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OTruncateClassStatementExecutionTest.java index 111bfa8a4a7..8714f21da24 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OTruncateClassStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OTruncateClassStatementExecutionTest.java @@ -22,7 +22,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OTruncateClassStatementExecutionTest extends BaseMemoryInternalDatabase { @SuppressWarnings("unchecked") @@ -123,10 +125,12 @@ public void testTruncateVertexClassSubclassesWithIndex() { db.command("create class TestTruncateVertexClassSuperclassWithIndex"); db.command("create property TestTruncateVertexClassSuperclassWithIndex.name STRING"); db.command( - "create index TestTruncateVertexClassSuperclassWithIndex_index on TestTruncateVertexClassSuperclassWithIndex (name) NOTUNIQUE"); + "create index TestTruncateVertexClassSuperclassWithIndex_index on" + + " TestTruncateVertexClassSuperclassWithIndex (name) NOTUNIQUE"); db.command( - "create class TestTruncateVertexClassSubclassWithIndex extends TestTruncateVertexClassSuperclassWithIndex"); + "create class TestTruncateVertexClassSubclassWithIndex extends" + + " TestTruncateVertexClassSuperclassWithIndex"); db.command("insert into TestTruncateVertexClassSuperclassWithIndex set name = 'foo'"); db.command("insert into TestTruncateVertexClassSubclassWithIndex set name = 'bar'"); diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OTruncateClusterStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OTruncateClusterStatementExecutionTest.java index 00e1bb0982f..955f8926f90 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OTruncateClusterStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OTruncateClusterStatementExecutionTest.java @@ -10,7 +10,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OTruncateClusterStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OTruncateRecordStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OTruncateRecordStatementExecutionTest.java index 4408fe95954..5942c06bf09 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OTruncateRecordStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OTruncateRecordStatementExecutionTest.java @@ -9,7 +9,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OTruncateRecordStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OUpdateEdgeStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OUpdateEdgeStatementExecutionTest.java index ad078ac5ae8..a2c7a4a5641 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OUpdateEdgeStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OUpdateEdgeStatementExecutionTest.java @@ -7,7 +7,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OUpdateEdgeStatementExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OUpdateStatementExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OUpdateStatementExecutionTest.java index a596fa4e488..b1359f1f67c 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OUpdateStatementExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OUpdateStatementExecutionTest.java @@ -27,7 +27,9 @@ import org.junit.Test; import org.junit.rules.TestName; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OUpdateStatementExecutionTest { @Rule public TestName name = new TestName(); diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OWhileBlockExecutionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OWhileBlockExecutionTest.java index 9da735e6804..53f57894760 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OWhileBlockExecutionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/OWhileBlockExecutionTest.java @@ -4,7 +4,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OWhileBlockExecutionTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/SQLCreateVertexAndEdgeTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/SQLCreateVertexAndEdgeTest.java index e7aff144096..5467c0d200e 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/SQLCreateVertexAndEdgeTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/SQLCreateVertexAndEdgeTest.java @@ -179,7 +179,9 @@ public void testSqlScriptThatDeletesEdge() { db.command("create vertex V set name = 'testSqlScriptThatDeletesEdge1'").close(); db.command("create vertex V set name = 'testSqlScriptThatDeletesEdge2'").close(); db.command( - "create edge E from (select from V where name = 'testSqlScriptThatDeletesEdge1') to (select from V where name = 'testSqlScriptThatDeletesEdge2') set name = 'testSqlScriptThatDeletesEdge'") + "create edge E from (select from V where name = 'testSqlScriptThatDeletesEdge1') to" + + " (select from V where name = 'testSqlScriptThatDeletesEdge2') set name =" + + " 'testSqlScriptThatDeletesEdge'") .close(); try { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/metadata/OStatementIndexFinderTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/metadata/OStatementIndexFinderTest.java index aa99848dbbd..d1002f16a75 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/executor/metadata/OStatementIndexFinderTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/executor/metadata/OStatementIndexFinderTest.java @@ -193,7 +193,8 @@ public void simpleNestedAndOrMatchTest() { OSelectStatement stat = parseQuery( - "select from cl where (friend.name = 'a' and name='a') or (friend.name='b' and name='b') "); + "select from cl where (friend.name = 'a' and name='a') or (friend.name='b' and" + + " name='b') "); Optional result = stat.getWhereClause().findIndex(finder, ctx); assertTrue((result.get() instanceof ORequiredIndexCanditate)); @@ -223,7 +224,8 @@ public void simpleNestedAndOrPartialMatchTest() { OSelectStatement stat = parseQuery( - "select from cl where (friend.name = 'a' and name='a') or (friend.name='b' and name='b') "); + "select from cl where (friend.name = 'a' and name='a') or (friend.name='b' and" + + " name='b') "); Optional result = stat.getWhereClause().findIndex(finder, ctx); assertTrue((result.get() instanceof ORequiredIndexCanditate)); @@ -250,7 +252,8 @@ public void simpleNestedOrNotMatchTest() { OSelectStatement stat = parseQuery( - "select from cl where (friend.name = 'a' and name='a') or (friend.other='b' and other='b') "); + "select from cl where (friend.name = 'a' and name='a') or (friend.other='b' and" + + " other='b') "); Optional result = stat.getWhereClause().findIndex(finder, ctx); assertFalse(result.isPresent()); diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionConvertTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionConvertTest.java index 76b44f973a8..767fc1f73ff 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionConvertTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionConvertTest.java @@ -12,7 +12,9 @@ import java.util.Date; import org.junit.Test; -/** @author Luca Garulli (l.garulli--(at)--orientdb.com) */ +/** + * @author Luca Garulli (l.garulli--(at)--orientdb.com) + */ public class OSQLFunctionConvertTest extends BaseMemoryDatabase { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/operator/OQueryOperatorMinusTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/operator/OQueryOperatorMinusTest.java index 93fee9f9766..cb30c72cd09 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/operator/OQueryOperatorMinusTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/operator/OQueryOperatorMinusTest.java @@ -25,7 +25,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OQueryOperatorMinusTest { @Test public void test() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OAlterSecurityPolicyStatementTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OAlterSecurityPolicyStatementTest.java index 11381d88da6..4d5b9a9e1a8 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OAlterSecurityPolicyStatementTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OAlterSecurityPolicyStatementTest.java @@ -11,16 +11,19 @@ public void testPlain() { checkRightSyntax("ALTER SECURITY POLICY foo SET CREATE = (foo = 'bar') REMOVE DELETE"); checkRightSyntax( - "ALTER SECURITY POLICY foo SET CREATE = (name = 'foo'), READ = (name = 'foo')" - + ", BEFORE UPDATE = (name = 'foo'), AFTER UPDATE = (name = 'foo'), DELETE = (name = 'foo'), EXECUTE = (name = 'foo')"); + "ALTER SECURITY POLICY foo SET CREATE = (name = 'foo'), READ = (name = 'foo'), BEFORE" + + " UPDATE = (name = 'foo'), AFTER UPDATE = (name = 'foo'), DELETE = (name = 'foo')," + + " EXECUTE = (name = 'foo')"); checkRightSyntax( - "ALTER SECURITY POLICY foo REMOVE CREATE, READ, BEFORE UPDATE, AFTER UPDATE, DELETE, EXECUTE"); + "ALTER SECURITY POLICY foo REMOVE CREATE, READ, BEFORE UPDATE, AFTER UPDATE, DELETE," + + " EXECUTE"); checkRightSyntax( - "ALTER SECURITY POLICY foo SET CREATE = (name = 'foo'), READ = (name = 'foo')" - + ", BEFORE UPDATE = (name = 'foo'), AFTER UPDATE = (name = 'foo'), DELETE = (name = 'foo'), EXECUTE = (name = 'foo') " - + "REMOVE CREATE, READ, BEFORE UPDATE, AFTER UPDATE, DELETE, EXECUTE"); + "ALTER SECURITY POLICY foo SET CREATE = (name = 'foo'), READ = (name = 'foo'), BEFORE" + + " UPDATE = (name = 'foo'), AFTER UPDATE = (name = 'foo'), DELETE = (name = 'foo')," + + " EXECUTE = (name = 'foo') REMOVE CREATE, READ, BEFORE UPDATE, AFTER UPDATE, DELETE," + + " EXECUTE"); checkWrongSyntax("ALTER SECURITY POLICY foo"); } diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateDatabaseStatementTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateDatabaseStatementTest.java index d2eb9704b0c..9fab30cc574 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateDatabaseStatementTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateDatabaseStatementTest.java @@ -14,10 +14,12 @@ public void testPlain() { checkRightSyntaxServer( "CREATE DATABASE foo plocal users (foo identified by 'pippo' role admin)"); checkRightSyntaxServer( - "CREATE DATABASE foo plocal users (foo identified by 'pippo' role admin, reader identified by ? role [reader, writer])"); + "CREATE DATABASE foo plocal users (foo identified by 'pippo' role admin, reader identified" + + " by ? role [reader, writer])"); checkRightSyntaxServer( - "CREATE DATABASE foo plocal users (foo identified by 'pippo' role admin) {\"config\":{\"security.createDefaultUsers\": true}}"); + "CREATE DATABASE foo plocal users (foo identified by 'pippo' role admin)" + + " {\"config\":{\"security.createDefaultUsers\": true}}"); checkWrongSyntax("CREATE DATABASE foo"); checkWrongSyntax("CREATE DATABASE"); diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateEdgeStatementTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateEdgeStatementTest.java index becdadbb169..0191a97939f 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateEdgeStatementTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateEdgeStatementTest.java @@ -67,13 +67,15 @@ public void testCreateFromRidArraySet() { @Test public void testRetrySet() { checkRightSyntax( - "create edge Foo from [#11:0, #11:3] to [#11:1, #12:0] set foo='bar', bar=2 retry 3 wait 20"); + "create edge Foo from [#11:0, #11:3] to [#11:1, #12:0] set foo='bar', bar=2 retry 3 wait" + + " 20"); } @Test public void testBatch() { checkRightSyntax( - "create edge Foo from [#11:0, #11:3] to [#11:1, #12:0] set foo='bar', bar=2 retry 3 wait 20 batch 10"); + "create edge Foo from [#11:0, #11:3] to [#11:1, #12:0] set foo='bar', bar=2 retry 3 wait 20" + + " batch 10"); } public void testInputVariables() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateFunctionStatementTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateFunctionStatementTest.java index 31108b0fe7e..b853e15f682 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateFunctionStatementTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateFunctionStatementTest.java @@ -9,8 +9,10 @@ public void testPlain() { checkRightSyntax("CREATE FUNCTION test \"print('\\nTest!')\""); checkRightSyntax("CREATE FUNCTION test \"return a + b;\" PARAMETERS [a,b]"); checkRightSyntax( - "CREATE FUNCTION allUsersButAdmin \"SELECT FROM ouser WHERE name <> 'admin'\" LANGUAGE SQL"); + "CREATE FUNCTION allUsersButAdmin \"SELECT FROM ouser WHERE name <> 'admin'\" LANGUAGE" + + " SQL"); checkRightSyntax( - "create function allUsersButAdmin \"SELECT FROM ouser WHERE name <> 'admin'\" parameters [a,b] language SQL"); + "create function allUsersButAdmin \"SELECT FROM ouser WHERE name <> 'admin'\" parameters" + + " [a,b] language SQL"); } } diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreatePropertyStatementTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreatePropertyStatementTest.java index 904b043828f..c22156a61c2 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreatePropertyStatementTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreatePropertyStatementTest.java @@ -15,7 +15,8 @@ public void testPlain() { checkRightSyntax("CREATE PROPERTY `Foo bar`.`bar baz` LINK Bar unsafe"); checkRightSyntax( - "CREATE PROPERTY Foo.bar Integer (MANDATORY, READONLY, NOTNULL, MAX 5, MIN 3, DEFAULT 7) UNSAFE"); + "CREATE PROPERTY Foo.bar Integer (MANDATORY, READONLY, NOTNULL, MAX 5, MIN 3, DEFAULT 7)" + + " UNSAFE"); checkRightSyntax( "CREATE PROPERTY Foo.bar Integer (MANDATORY, READONLY, NOTNULL, MAX 5, MIN 3, DEFAULT 7)"); @@ -23,7 +24,8 @@ public void testPlain() { "CREATE PROPERTY Foo.bar LINK Bar (MANDATORY, READONLY, NOTNULL, MAX 5, MIN 3, DEFAULT 7)"); checkRightSyntax( - "CREATE PROPERTY Foo.bar LINK Bar (MANDATORY true, READONLY false, NOTNULL true, MAX 5, MIN 3, DEFAULT 7) UNSAFE"); + "CREATE PROPERTY Foo.bar LINK Bar (MANDATORY true, READONLY false, NOTNULL true, MAX 5, MIN" + + " 3, DEFAULT 7) UNSAFE"); } @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateSecurityPolicyStatementTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateSecurityPolicyStatementTest.java index 53a92760556..41357a4836b 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateSecurityPolicyStatementTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateSecurityPolicyStatementTest.java @@ -12,8 +12,9 @@ public void testPlain() { checkRightSyntax("CREATE SECURITY POLICY foo SET read = (name = 'foo')"); checkRightSyntax( - "CREATE SECURITY POLICY foo SET CREATE = (name = 'foo'), READ = (name = 'foo')" - + ", BEFORE UPDATE = (name = 'foo'), AFTER UPDATE = (name = 'foo'), DELETE = (name = 'foo'), EXECUTE = (name = 'foo')"); + "CREATE SECURITY POLICY foo SET CREATE = (name = 'foo'), READ = (name = 'foo'), BEFORE" + + " UPDATE = (name = 'foo'), AFTER UPDATE = (name = 'foo'), DELETE = (name = 'foo')," + + " EXECUTE = (name = 'foo')"); checkWrongSyntax("CREATE SECURITY POLICY foo SET foo = (name = 'foo')"); } diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateVertexStatementTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateVertexStatementTest.java index 61b506db5d3..9d226f3b576 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateVertexStatementTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateVertexStatementTest.java @@ -75,7 +75,8 @@ public void testEmptyMapCreate() { @Test public void testInsertIntoCluster() { checkRightSyntax( - "create vertex cluster:default (equaledges, name, list) values ('yes', 'square', ['bottom', 'top','left','right'] )"); + "create vertex cluster:default (equaledges, name, list) values ('yes', 'square', ['bottom'," + + " 'top','left','right'] )"); } private void printTree(String s) { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateViewStatementTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateViewStatementTest.java index 38b1f57b79f..94e05ccf34c 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateViewStatementTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OCreateViewStatementTest.java @@ -11,13 +11,17 @@ public void testPlain() { checkRightSyntax("create view Foo from (MATCH {class:V} RETURN $elements)"); checkRightSyntax( - "CREATE VIEW Foo FROM (select from v where name ='foo') METADATA {updatable:true, originRidField:'origin'}"); + "CREATE VIEW Foo FROM (select from v where name ='foo') METADATA {updatable:true," + + " originRidField:'origin'}"); checkWrongSyntax("create view Foo"); checkRightSyntax( - "CREATE VIEW Foo FROM (select from v where name ='foo') METADATA {indexes:[{type:'UNIQUE', properties:{name:'STRING'}}]}"); + "CREATE VIEW Foo FROM (select from v where name ='foo') METADATA {indexes:[{type:'UNIQUE'," + + " properties:{name:'STRING'}}]}"); checkRightSyntax( - "CREATE VIEW Foo FROM (select from v where name ='foo') METADATA {indexes:[{\"type\":\"unique\", \"properties\":{\"ids\":{\"type\":\"EMBEDDEDEDSET\",\"linkedType\":\"STRING\"}}}]}"); + "CREATE VIEW Foo FROM (select from v where name ='foo') METADATA" + + " {indexes:[{\"type\":\"unique\"," + + " \"properties\":{\"ids\":{\"type\":\"EMBEDDEDEDSET\",\"linkedType\":\"STRING\"}}}]}"); } @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/ODeleteEdgeStatementTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/ODeleteEdgeStatementTest.java index 6fc6faaf067..a2f953d20f3 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/ODeleteEdgeStatementTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/ODeleteEdgeStatementTest.java @@ -40,17 +40,20 @@ public void testDeleteEdge() { checkRightSyntax("DELETE EDGE E to #12:0"); checkRightSyntax("DELETE EDGE E from #12:0 to #12:1"); checkRightSyntax( - "DELETE EDGE E from (select from V where name = 'foo') to (select from V where name = 'bar')"); + "DELETE EDGE E from (select from V where name = 'foo') to (select from V where name =" + + " 'bar')"); checkRightSyntax( - "DELETE EDGE E from (select from V where name = 'foo') to (select from V where name = 'bar') BATCH 14"); + "DELETE EDGE E from (select from V where name = 'foo') to (select from V where name =" + + " 'bar') BATCH 14"); checkRightSyntax("DELETE EDGE E where age = 50"); checkRightSyntax("DELETE EDGE E from #12:0 where age = 50"); checkRightSyntax("DELETE EDGE E to #12:0 where age = 50"); checkRightSyntax("DELETE EDGE E from #12:0 to #12:1 where age = 50"); checkRightSyntax( - "DELETE EDGE E from (select from V where name = 'foo') to (select from V where name = 'bar') where age = 50"); + "DELETE EDGE E from (select from V where name = 'foo') to (select from V where name =" + + " 'bar') where age = 50"); checkRightSyntax("DELETE EDGE E from (select foo()) to (select bar())"); checkRightSyntax("DELETE EDGE E from ? to ?"); checkRightSyntax("DELETE EDGE E from :foo to :bar"); @@ -66,14 +69,16 @@ public void testDeleteEdge() { checkRightSyntax("DELETE EDGE to (select foo())"); checkRightSyntax("DELETE EDGE from #12:0 to #12:1"); checkRightSyntax( - "DELETE EDGE from (select from V where name = 'foo') to (select from V where name = 'bar')"); + "DELETE EDGE from (select from V where name = 'foo') to (select from V where name =" + + " 'bar')"); checkRightSyntax("DELETE EDGE where age = 50"); checkRightSyntax("DELETE EDGE from #12:0 where age = 50"); checkRightSyntax("DELETE EDGE to #12:0 where age = 50"); checkRightSyntax("DELETE EDGE from #12:0 to #12:1 where age = 50"); checkRightSyntax( - "DELETE EDGE from (select from V where name = 'foo') to (select from V where name = 'bar') where age = 50"); + "DELETE EDGE from (select from V where name = 'foo') to (select from V where name = 'bar')" + + " where age = 50"); checkRightSyntax("DELETE EDGE from [#12:0, #12:1] to [#13:0, #13:1] where age = 50"); checkRightSyntax("DELETE EDGE from [#13:0, #13:1] where age = 50"); diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OInsertStatementTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OInsertStatementTest.java index e81bf627107..c4e21c3ab22 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OInsertStatementTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OInsertStatementTest.java @@ -47,14 +47,18 @@ public void testSimpleInsert() { @Test public void testInsertIntoCluster() { checkRightSyntax( - "insert into cluster:default (equaledges, name, list) values ('yes', 'square', ['bottom', 'top','left','right'] )"); + "insert into cluster:default (equaledges, name, list) values ('yes', 'square', ['bottom'," + + " 'top','left','right'] )"); checkRightSyntax( - "insert into CLUSTER:default (equaledges, name, list) values ('yes', 'square', ['bottom', 'top','left','right'] )"); + "insert into CLUSTER:default (equaledges, name, list) values ('yes', 'square', ['bottom'," + + " 'top','left','right'] )"); checkRightSyntax( - "insert into Foo cluster foo1 (equaledges, name, list) values ('yes', 'square', ['bottom', 'top','left','right'] )"); + "insert into Foo cluster foo1 (equaledges, name, list) values ('yes', 'square', ['bottom'," + + " 'top','left','right'] )"); checkRightSyntax( - "insert into Foo CLUSTER foo1 (equaledges, name, list) values ('yes', 'square', ['bottom', 'top','left','right'] )"); + "insert into Foo CLUSTER foo1 (equaledges, name, list) values ('yes', 'square', ['bottom'," + + " 'top','left','right'] )"); } @Test @@ -92,7 +96,8 @@ public void testInsertEmbeddedDocs() { public void testInsertContent() { checkRightSyntax("insert into Activity content {'name':'name1', 'surname':'surname1'}"); checkRightSyntax( - "insert into Activity content {'name':'name1', 'surname':'surname1'}, {'name':'name2', 'surname':'surname2'}"); + "insert into Activity content {'name':'name1', 'surname':'surname1'}, {'name':'name2'," + + " 'surname':'surname2'}"); } @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OMatchStatementTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OMatchStatementTest.java index a5f92a70394..9b4ccb2f3ae 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OMatchStatementTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OMatchStatementTest.java @@ -79,7 +79,8 @@ public void testLongPath() { @Test public void testLongPath2() { checkRightSyntax( - "MATCH {class: 'V', as: foo}.out().in('foo'){}.both('bar'){CLASS: 'bar'}.out(){as: bar} RETURN foo"); + "MATCH {class: 'V', as: foo}.out().in('foo'){}.both('bar'){CLASS: 'bar'}.out(){as: bar}" + + " RETURN foo"); } @Test @@ -188,13 +189,15 @@ public void testUnwind() { @Test public void testDepthAlias() { checkRightSyntax( - "MATCH {class: 'V', as: foo}-->{as:bar, while:($depth < 2), depthAlias: depth} RETURN depth"); + "MATCH {class: 'V', as: foo}-->{as:bar, while:($depth < 2), depthAlias: depth} RETURN" + + " depth"); } @Test public void testPathAlias() { checkRightSyntax( - "MATCH {class: 'V', as: foo}-->{as:bar, while:($depth < 2), pathAlias: barPath} RETURN barPath"); + "MATCH {class: 'V', as: foo}-->{as:bar, while:($depth < 2), pathAlias: barPath} RETURN" + + " barPath"); } @Test @@ -225,11 +228,13 @@ public void testFieldTraversal() { checkRightSyntax( "MATCH {class: 'V', as: foo}.toBar{as:bar} RETURN foo.name, bar.name skip 10 limit 10"); checkRightSyntax( - "MATCH {class: 'V', as: foo}.toBar{as:bar}.out(){as:c} RETURN foo.name, bar.name skip 10 limit 10"); + "MATCH {class: 'V', as: foo}.toBar{as:bar}.out(){as:c} RETURN foo.name, bar.name skip 10" + + " limit 10"); checkRightSyntax( "MATCH {class: 'V', as: foo}.toBar.baz{as:bar} RETURN foo.name, bar.name skip 10 limit 10"); checkRightSyntax( - "MATCH {class: 'V', as: foo}.toBar.out(){as:bar} RETURN foo.name, bar.name skip 10 limit 10"); + "MATCH {class: 'V', as: foo}.toBar.out(){as:bar} RETURN foo.name, bar.name skip 10 limit" + + " 10"); } protected OrientSql getParserFor(String string) { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OMoveVertexStatementTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OMoveVertexStatementTest.java index 38301dabfbe..7cad8997ecb 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OMoveVertexStatementTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OMoveVertexStatementTest.java @@ -12,7 +12,8 @@ public void test() { checkRightSyntax( "move vertex (select from V) to class:newposition set name = 'a', surname = 'b'"); checkRightSyntax( - "move vertex (select from V) to class:newposition set name = 'a', surname = 'b' batch 1000"); + "move vertex (select from V) to class:newposition set name = 'a', surname = 'b' batch" + + " 1000"); checkWrongSyntax("move vertex (select from V) to newposition"); } diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OSelectStatementTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OSelectStatementTest.java index 06fe9fb5a7f..890373b4ddc 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OSelectStatementTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OSelectStatementTest.java @@ -330,24 +330,29 @@ public void testEscape2() { public void testSpatial() { checkRightSyntax( - "select *,$distance from Place where [latitude,longitude,$spatial] NEAR [41.893056,12.482778,{\"maxDistance\": 0.5}]"); + "select *,$distance from Place where [latitude,longitude,$spatial] NEAR" + + " [41.893056,12.482778,{\"maxDistance\": 0.5}]"); checkRightSyntax( - "select * from Place where [latitude,longitude] WITHIN [[51.507222,-0.1275],[55.507222,-0.1275]]"); + "select * from Place where [latitude,longitude] WITHIN" + + " [[51.507222,-0.1275],[55.507222,-0.1275]]"); } @Test public void testSubConditions() { checkRightSyntax( - "SELECT @rid as rid, localName FROM Person WHERE ( 'milano' IN out('lives').localName OR 'roma' IN out('lives').localName ) ORDER BY age ASC"); + "SELECT @rid as rid, localName FROM Person WHERE ( 'milano' IN out('lives').localName OR" + + " 'roma' IN out('lives').localName ) ORDER BY age ASC"); } @Test public void testRecordAttributes() { // issue #4430 checkRightSyntax( - "SELECT @this, @rid, @rid_id, @rid_pos, @version, @class, @type, @size, @fields, @raw from V"); + "SELECT @this, @rid, @rid_id, @rid_pos, @version, @class, @type, @size, @fields, @raw from" + + " V"); checkRightSyntax( - "SELECT @THIS, @RID, @RID_ID, @RID_POS, @VERSION, @CLASS, @TYPE, @SIZE, @FIELDS, @RAW from V"); + "SELECT @THIS, @RID, @RID_ID, @RID_POS, @VERSION, @CLASS, @TYPE, @SIZE, @FIELDS, @RAW from" + + " V"); } @Test @@ -363,7 +368,8 @@ public void testMatches() { checkRightSyntax("select from Person where name matches 'a'"); checkRightSyntax( - "select from Person where name matches '(?i)(^\\\\Qname1\\\\E$)|(^\\\\Qname2\\\\E$)|(^\\\\Qname3\\\\E$)' and age=30"); + "select from Person where name matches" + + " '(?i)(^\\\\Qname1\\\\E$)|(^\\\\Qname2\\\\E$)|(^\\\\Qname3\\\\E$)' and age=30"); } @Test @@ -448,13 +454,16 @@ public void testMultipleLucene() { checkWrongSyntax("select from Foo where a lucene 'a' and b lucene 'a'"); checkWrongSyntax( - "select union($a, $b) let $a = (select from Foo where a lucene 'a' and b lucene 'b'), $b = (select from Foo where b lucene 'b')"); + "select union($a, $b) let $a = (select from Foo where a lucene 'a' and b lucene 'b'), $b =" + + " (select from Foo where b lucene 'b')"); checkRightSyntax( - "select union($a, $b) let $a = (select from Foo where a lucene 'a'), $b = (select from Foo where b lucene 'b')"); + "select union($a, $b) let $a = (select from Foo where a lucene 'a'), $b = (select from Foo" + + " where b lucene 'b')"); checkWrongSyntax("select from (select from Foo) where a lucene 'a'"); checkWrongSyntax( - "select from Foo where (a=2 and b=3 and (a = 4 and (b=5 and d lucene 'foo')))) or select from Foo where (a=2 and b=3 and (a = 4 and (b=5 and d lucene 'foo'))))"); + "select from Foo where (a=2 and b=3 and (a = 4 and (b=5 and d lucene 'foo')))) or select" + + " from Foo where (a=2 and b=3 and (a = 4 and (b=5 and d lucene 'foo'))))"); checkWrongSyntax("select from cluster:foo where a lucene 'b'"); checkWrongSyntax("select from #12:0 where a lucene 'b'"); @@ -658,12 +667,14 @@ public void testSkipLimitInQueryWithNoTarget() { // issue #5589 checkRightSyntax( "SELECT eval('$TotalListsQuery[0].Count') AS TotalLists\n" - + " LET $TotalListsQuery = ( SELECT Count(1) AS Count FROM ContactList WHERE Account=#20:1 AND EntityInfo.State=0)\n" + + " LET $TotalListsQuery = ( SELECT Count(1) AS Count FROM ContactList WHERE" + + " Account=#20:1 AND EntityInfo.State=0)\n" + " LIMIT 1"); checkRightSyntax( "SELECT eval('$TotalListsQuery[0].Count') AS TotalLists\n" - + " LET $TotalListsQuery = ( SELECT Count(1) AS Count FROM ContactList WHERE Account=#20:1 AND EntityInfo.State=0)\n" + + " LET $TotalListsQuery = ( SELECT Count(1) AS Count FROM ContactList WHERE" + + " Account=#20:1 AND EntityInfo.State=0)\n" + " SKIP 10 LIMIT 1"); } diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OUpdateEdgeStatementTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OUpdateEdgeStatementTest.java index 946b6422871..9bae21e395a 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OUpdateEdgeStatementTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OUpdateEdgeStatementTest.java @@ -89,14 +89,17 @@ public void testDecrement() { @Test public void testQuotedJson() { checkRightSyntax( - "update edge E SET key = \"test\", value = {\"f12\":\"test\\\\\"} UPSERT WHERE key = \"test\""); + "update edge E SET key = \"test\", value = {\"f12\":\"test\\\\\"} UPSERT WHERE key =" + + " \"test\""); } @Test public void testTargetQuery() { // issue #4415 checkRightSyntax( - "update edge (select from (traverse References from ( select from Node WHERE Email = 'julia@local' ) ) WHERE @class = 'Node' and $depth <= 1 and Active = true ) set Points = 0 RETURN BEFORE $current.Points"); + "update edge (select from (traverse References from ( select from Node WHERE Email =" + + " 'julia@local' ) ) WHERE @class = 'Node' and $depth <= 1 and Active = true ) set" + + " Points = 0 RETURN BEFORE $current.Points"); } @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OUpdateStatementTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OUpdateStatementTest.java index 1f9aea1c895..33948c3730d 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OUpdateStatementTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/OUpdateStatementTest.java @@ -102,7 +102,9 @@ public void testQuotedJson() { public void testTargetQuery() { // issue #4415 checkRightSyntax( - "update (select from (traverse References from ( select from Node WHERE Email = 'julia@local' ) ) WHERE @class = 'Node' and $depth <= 1 and Active = true ) set Points = 0 RETURN BEFORE $current.Points"); + "update (select from (traverse References from ( select from Node WHERE Email =" + + " 'julia@local' ) ) WHERE @class = 'Node' and $depth <= 1 and Active = true ) set" + + " Points = 0 RETURN BEFORE $current.Points"); } @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/PatternTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/PatternTest.java index b589985dc94..305935efba9 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/PatternTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/PatternTest.java @@ -59,7 +59,8 @@ public void testCartesianProduct() { @Test public void testComplexCartesianProduct() { String query = - "MATCH {as:a, class:Person}-->{as:b}, {as:c, class:Person}-->{as:d}-->{as:e}, {as:d, class:Foo}-->{as:f} return a, b"; + "MATCH {as:a, class:Person}-->{as:b}, {as:c, class:Person}-->{as:d}-->{as:e}, {as:d," + + " class:Foo}-->{as:f} return a, b"; OrientSql parser = getParserFor(query); try { OMatchStatement stm = (OMatchStatement) parser.parse(); diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OContainsConditionTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OContainsConditionTest.java index 13a1beae147..6427cd3eb36 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OContainsConditionTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OContainsConditionTest.java @@ -27,7 +27,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OContainsConditionTest { @Test public void test() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OContainsKeyOperatorTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OContainsKeyOperatorTest.java index 8cbd3b9da1e..18ccbe3d06b 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OContainsKeyOperatorTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OContainsKeyOperatorTest.java @@ -25,7 +25,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OContainsKeyOperatorTest { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OContainsValueOperatorTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OContainsValueOperatorTest.java index 3f092f61855..5eec6b5dfe2 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OContainsValueOperatorTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OContainsValueOperatorTest.java @@ -25,7 +25,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OContainsValueOperatorTest { @Test public void test() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OEqualsCompareOperatorTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OEqualsCompareOperatorTest.java index b63d10825ca..3695ffa076a 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OEqualsCompareOperatorTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OEqualsCompareOperatorTest.java @@ -25,7 +25,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OEqualsCompareOperatorTest { @Test public void test() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OGeOperatorTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OGeOperatorTest.java index d98295f48e9..e7d5fa72c65 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OGeOperatorTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OGeOperatorTest.java @@ -24,7 +24,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OGeOperatorTest { @Test public void test() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OGtOperatorTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OGtOperatorTest.java index 1afcfba4de5..ab2df077dd1 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OGtOperatorTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OGtOperatorTest.java @@ -24,7 +24,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OGtOperatorTest { @Test public void test() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OInOperatorTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OInOperatorTest.java index 66aacc628ec..d107783537b 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OInOperatorTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OInOperatorTest.java @@ -25,7 +25,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OInOperatorTest { @Test public void test() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OLeOperatorTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OLeOperatorTest.java index 415599b838b..0c86329a179 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OLeOperatorTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OLeOperatorTest.java @@ -24,7 +24,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OLeOperatorTest { @Test public void test() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OLikeOperatorTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OLikeOperatorTest.java index 16f72f832d2..2c288e528d4 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OLikeOperatorTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OLikeOperatorTest.java @@ -23,7 +23,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OLikeOperatorTest { @Test public void test() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OLtOperatorTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OLtOperatorTest.java index fb07e500217..ebd73144b55 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OLtOperatorTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/OLtOperatorTest.java @@ -24,7 +24,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class OLtOperatorTest { @Test public void test() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/ONeOperatorTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/ONeOperatorTest.java index 479ba0a6a83..439ca2e36e3 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/ONeOperatorTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/ONeOperatorTest.java @@ -25,7 +25,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class ONeOperatorTest { @Test public void test() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/ONearOperatorTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/ONearOperatorTest.java index cbfabed2f4c..228ebc3bb02 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/ONearOperatorTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/ONearOperatorTest.java @@ -22,7 +22,9 @@ import com.orientechnologies.orient.core.sql.parser.OLuceneOperator; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class ONearOperatorTest { @Test public void test() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/ONeqOperatorTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/ONeqOperatorTest.java index 378d379a29a..24b4a22c40b 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/ONeqOperatorTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/parser/operators/ONeqOperatorTest.java @@ -25,7 +25,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class ONeqOperatorTest { @Test public void test() { diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/select/TestManyProperties.java b/core/src/test/java/com/orientechnologies/orient/core/sql/select/TestManyProperties.java index d5781867296..5732c0a5099 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/select/TestManyProperties.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/select/TestManyProperties.java @@ -49,7 +49,19 @@ public void test() { try (OResultSet set = session.query( - "SELECT FROM test WHERE (((property1 is null) or (property1 = #107:150)) and ((property2 is null) or (property2 = #107:150)) and ((property3 is null) or (property3 = #107:150)) and ((property4 is null) or (property4 = #107:150)) and ((property5 is null) or (property5 = #107:150)) and ((property6 is null) or (property6 = #107:150)) and ((property7 is null) or (property7 = #107:150)) and ((property8 is null) or (property8 = #107:150)) and ((property9 is null) or (property9 = #107:150)) and ((property10 is null) or (property10 = #107:150)) and ((property11 is null) or (property11 = #107:150)) and ((property12 is null) or (property12 = #107:150)) and ((property13 is null) or (property13 = #107:150)) and ((property14 is null) or (property14 = #107:150)) and ((property15 is null) or (property15 = #107:150)) and ((property16 is null) or (property16 = #107:150)) and ((property17 is null) or (property17 = #107:150)))")) { + "SELECT FROM test WHERE (((property1 is null) or (property1 = #107:150)) and" + + " ((property2 is null) or (property2 = #107:150)) and ((property3 is null) or" + + " (property3 = #107:150)) and ((property4 is null) or (property4 = #107:150))" + + " and ((property5 is null) or (property5 = #107:150)) and ((property6 is" + + " null) or (property6 = #107:150)) and ((property7 is null) or (property7 =" + + " #107:150)) and ((property8 is null) or (property8 = #107:150)) and" + + " ((property9 is null) or (property9 = #107:150)) and ((property10 is null)" + + " or (property10 = #107:150)) and ((property11 is null) or (property11 =" + + " #107:150)) and ((property12 is null) or (property12 = #107:150)) and" + + " ((property13 is null) or (property13 = #107:150)) and ((property14 is null)" + + " or (property14 = #107:150)) and ((property15 is null) or (property15 =" + + " #107:150)) and ((property16 is null) or (property16 = #107:150)) and" + + " ((property17 is null) or (property17 = #107:150)))")) { assertEquals(set.stream().count(), 0); } } diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/select/TestSqlEmbeddedResult.java b/core/src/test/java/com/orientechnologies/orient/core/sql/select/TestSqlEmbeddedResult.java index e28d6c824d7..aecebe93566 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/select/TestSqlEmbeddedResult.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/select/TestSqlEmbeddedResult.java @@ -27,7 +27,8 @@ public void testEmbeddedRusultTypeNotLink() { List res = db.query( new OSQLSynchQuery( - "select $Pics[0] as el FROM Test LET $Pics = (select expand( rel.include('format')) from $current)")); + "select $Pics[0] as el FROM Test LET $Pics = (select expand( rel.include('format'))" + + " from $current)")); Assert.assertEquals(res.size(), 1); ODocument ele = res.get(0); Assert.assertNotNull(ele.field("el")); @@ -40,7 +41,8 @@ public void testEmbeddedRusultTypeNotLink() { res = db.query( new OSQLSynchQuery( - "select $Pics as el FROM Test LET $Pics = (select expand( rel.include('format')) from $current)")); + "select $Pics as el FROM Test LET $Pics = (select expand( rel.include('format'))" + + " from $current)")); Assert.assertEquals(res.size(), 1); ele = res.get(0); diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/select/TestSqlForeach.java b/core/src/test/java/com/orientechnologies/orient/core/sql/select/TestSqlForeach.java index 46f9ea44a9b..adb2944ca98 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/select/TestSqlForeach.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/select/TestSqlForeach.java @@ -17,7 +17,8 @@ public void testForeach() { OResultSet result = db.execute( "sql", - "let $res = select from Test; foreach ($r in $res) { update $r set timestamp = sysdate(); }; return $res; "); + "let $res = select from Test; foreach ($r in $res) { update $r set timestamp =" + + " sysdate(); }; return $res; "); Assert.assertTrue(result.hasNext()); diff --git a/core/src/test/java/com/orientechnologies/orient/core/storage/OStorageEncryptionTestIT.java b/core/src/test/java/com/orientechnologies/orient/core/storage/OStorageEncryptionTestIT.java index b117cd83c52..9e8fc508ce6 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/storage/OStorageEncryptionTestIT.java +++ b/core/src/test/java/com/orientechnologies/orient/core/storage/OStorageEncryptionTestIT.java @@ -52,9 +52,10 @@ public void testEncryption() { document.setProperty("id", i); document.setProperty( "value", - "Lorem ipsum dolor sit amet, consectetur adipiscing elit, " - + "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam," - + " quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. "); + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor" + + " incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis" + + " nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat." + + " "); document.save(); } @@ -188,9 +189,10 @@ public void testEncryptionSingleDatabase() { document.setProperty("id", 10); document.setProperty( "value", - "Lorem ipsum dolor sit amet, consectetur adipiscing elit, " - + "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam," - + " quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. "); + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor" + + " incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis" + + " nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat." + + " "); document.save(); try (OResultSet resultSet = session.query("select from EncryptedData where id = ?", 10)) { diff --git a/core/src/test/java/com/orientechnologies/orient/core/storage/OStorageTestIT.java b/core/src/test/java/com/orientechnologies/orient/core/storage/OStorageTestIT.java index 0119491ae4b..713e26c96b2 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/storage/OStorageTestIT.java +++ b/core/src/test/java/com/orientechnologies/orient/core/storage/OStorageTestIT.java @@ -80,7 +80,7 @@ public void testCheckSumFailureReadOnly() throws Exception { long fileId = wowCache.fileIdByName("pagebreak.pcl"); String nativeFileName = wowCache.nativeFileNameById(fileId); - storage.close(true, false); + storage.shutdown(); ctx.close(); int position = 3 * 1024; @@ -144,7 +144,7 @@ public void testCheckMagicNumberReadOnly() throws Exception { long fileId = wowCache.fileIdByName("pagebreak.pcl"); String nativeFileName = wowCache.nativeFileNameById(fileId); - storage.close(true, false); + storage.shutdown(); ctx.close(); int position = OFile.HEADER_SIZE + ODurablePage.MAGIC_NUMBER_OFFSET; @@ -204,7 +204,7 @@ public void testCheckMagicNumberVerify() throws Exception { long fileId = wowCache.fileIdByName("pagebreak.pcl"); String nativeFileName = wowCache.nativeFileNameById(fileId); - storage.close(true, false); + storage.shutdown(); ctx.close(); int position = OFile.HEADER_SIZE + ODurablePage.MAGIC_NUMBER_OFFSET; @@ -266,7 +266,7 @@ public void testCheckSumFailureVerifyAndLog() throws Exception { long fileId = wowCache.fileIdByName("pagebreak.pcl"); String nativeFileName = wowCache.nativeFileNameById(fileId); - storage.close(true, false); + storage.shutdown(); ctx.close(); int position = 3 * 1024; diff --git a/core/src/test/java/com/orientechnologies/orient/core/storage/StorageNamingTests.java b/core/src/test/java/com/orientechnologies/orient/core/storage/StorageNamingTests.java index aa43fd107b3..c97c7a83889 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/storage/StorageNamingTests.java +++ b/core/src/test/java/com/orientechnologies/orient/core/storage/StorageNamingTests.java @@ -27,7 +27,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Sergey Sitnikov */ +/** + * @author Sergey Sitnikov + */ public class StorageNamingTests { @Test diff --git a/core/src/test/java/com/orientechnologies/orient/core/storage/cache/chm/AsyncReadCacheTestIT.java b/core/src/test/java/com/orientechnologies/orient/core/storage/cache/chm/AsyncReadCacheTestIT.java index 4728bb0ad7e..090a5c888f0 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/storage/cache/chm/AsyncReadCacheTestIT.java +++ b/core/src/test/java/com/orientechnologies/orient/core/storage/cache/chm/AsyncReadCacheTestIT.java @@ -674,7 +674,8 @@ public long nextLong(long itemcount) { eta = (1 - Math.pow(2.0 / items, 1 - theta)) / (1 - zeta2theta / zetan); } else if ((itemcount < countforzeta) && (allowitemcountdecrease)) { System.err.println( - "WARNING: Recomputing Zipfian distribtion. This is slow and should be avoided. (itemcount=" + "WARNING: Recomputing Zipfian distribtion. This is slow and should be avoided." + + " (itemcount=" + itemcount + " countforzeta=" + countforzeta diff --git a/core/src/test/java/com/orientechnologies/orient/core/storage/cluster/ClusterPageTest.java b/core/src/test/java/com/orientechnologies/orient/core/storage/cluster/ClusterPageTest.java index 9fbfa06f1d3..6f6e65ffa69 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/storage/cluster/ClusterPageTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/storage/cluster/ClusterPageTest.java @@ -9,7 +9,6 @@ import com.orientechnologies.orient.core.storage.cache.OCacheEntry; import com.orientechnologies.orient.core.storage.cache.OCacheEntryImpl; import com.orientechnologies.orient.core.storage.cache.OCachePointer; -import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -26,7 +25,6 @@ * @since 20.03.13 */ public class ClusterPageTest { - private static final int SYSTEM_OFFSET = 24; @Test public void testAddOneRecord() { @@ -917,8 +915,9 @@ private void addFullPageDeleteAndAddAgain(OClusterPage localPage) { Assert.assertEquals(localPage.getRecordSize(entry.getKey()), 3); - if (deletedPositions.contains(entry.getKey())) + if (deletedPositions.contains(entry.getKey())) { Assert.assertEquals(localPage.getRecordVersion(entry.getKey()), recordVersion); + } } } @@ -1056,10 +1055,12 @@ private void addBigRecordDeleteAndAddSmallRecords(long seed, OClusterPage localP positionCounter.put(lastPosition, counter); counter++; - if (lastPosition == 0) Assert.assertEquals(localPage.getFreeSpace(), freeSpace - 15); - else + if (lastPosition == 0) { + Assert.assertEquals(localPage.getFreeSpace(), freeSpace - 15); + } else { Assert.assertEquals( localPage.getFreeSpace(), freeSpace - (19 + ORecordVersionHelper.SERIALIZED_SIZE)); + } freeSpace = localPage.getFreeSpace(); } @@ -1140,7 +1141,9 @@ private void findFirstRecord(long seed, OClusterPage localPage) { do { recordPosition = localPage.findFirstRecord(recordPosition); - if (recordPosition < 0) break; + if (recordPosition < 0) { + break; + } Assert.assertTrue(positions.contains(recordPosition)); Assert.assertTrue(recordPosition > lastRecordPosition); @@ -1219,7 +1222,9 @@ private void findLastRecord(long seed, OClusterPage localPage) { int lastRecordPosition = Integer.MAX_VALUE; do { recordPosition = localPage.findLastRecord(recordPosition); - if (recordPosition < 0) break; + if (recordPosition < 0) { + break; + } Assert.assertTrue(positions.contains(recordPosition)); Assert.assertTrue(recordPosition < lastRecordPosition); @@ -1424,12 +1429,4 @@ private void replaceOneRecordLowerVersion(OClusterPage localPage) { .isEqualTo(new byte[] {5, 2, 3, 4, 5, 11, 5, 4, 3, 2, 1}); Assert.assertEquals(localPage.getRecordVersion(index), recordVersion); } - - private byte[] getBytes(ByteBuffer buffer, int len) { - byte[] result = new byte[len]; - buffer.position(ClusterPageTest.SYSTEM_OFFSET); - buffer.get(result); - - return result; - } } diff --git a/core/src/test/java/com/orientechnologies/orient/core/storage/impl/local/paginated/StorageBackupMTStateTest.java b/core/src/test/java/com/orientechnologies/orient/core/storage/impl/local/paginated/StorageBackupMTStateTest.java index 1f7cb64e852..a390d942a51 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/storage/impl/local/paginated/StorageBackupMTStateTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/storage/impl/local/paginated/StorageBackupMTStateTest.java @@ -156,7 +156,7 @@ public void testRun() throws Exception { OStorage storage = ((ODatabaseDocumentInternal) databaseDocumentTx).getStorage(); databaseDocumentTx.close(); - storage.close(true, false); + storage.shutdown(); System.out.println("Create backup database"); final ODatabaseDocumentInternal backedUpDb = @@ -166,7 +166,7 @@ public void testRun() throws Exception { final OStorage backupStorage = ((ODatabaseDocumentInternal) backedUpDb).getStorage(); backedUpDb.close(); - backupStorage.close(true, false); + backupStorage.shutdown(); System.out.println("Compare databases"); diff --git a/core/src/test/java/com/orientechnologies/orient/core/storage/index/hashindex/local/cache/WOWCacheTestIT.java b/core/src/test/java/com/orientechnologies/orient/core/storage/index/hashindex/local/cache/WOWCacheTestIT.java index 9dd0919dfb8..12c453e105f 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/storage/index/hashindex/local/cache/WOWCacheTestIT.java +++ b/core/src/test/java/com/orientechnologies/orient/core/storage/index/hashindex/local/cache/WOWCacheTestIT.java @@ -193,11 +193,10 @@ public void testLoadStore() throws IOException { final OCachePointer cachePointer = wowCache.load(fileId, i, new OModifiableBoolean(), false); cachePointer.acquireExclusiveLock(); - ByteBuffer buffer = cachePointer.getBufferDuplicate(); + ByteBuffer buffer = cachePointer.getBuffer(); assert buffer != null; - buffer.position(ODurablePage.NEXT_FREE_POSITION); - buffer.put(data); + buffer.put(ODurablePage.NEXT_FREE_POSITION, data); cachePointer.releaseExclusiveLock(); wowCache.store(fileId, i, cachePointer); @@ -209,10 +208,9 @@ public void testLoadStore() throws IOException { OCachePointer cachePointer = wowCache.load(fileId, i, new OModifiableBoolean(), true); byte[] dataTwo = new byte[8]; - ByteBuffer buffer = cachePointer.getBufferDuplicate(); + ByteBuffer buffer = cachePointer.getBuffer(); assert buffer != null; - buffer.position(ODurablePage.NEXT_FREE_POSITION); - buffer.get(dataTwo); + buffer.get(ODurablePage.NEXT_FREE_POSITION, dataTwo); cachePointer.decrementReadersReferrer(); Assert.assertArrayEquals(dataTwo, dataOne); @@ -295,11 +293,10 @@ public void testLoadStoreEncrypted() throws Exception { final OCachePointer cachePointer = wowCache.load(fileId, i, new OModifiableBoolean(), false); cachePointer.acquireExclusiveLock(); - ByteBuffer buffer = cachePointer.getBufferDuplicate(); + ByteBuffer buffer = cachePointer.getBuffer(); assert buffer != null; - buffer.position(ODurablePage.NEXT_FREE_POSITION); - buffer.put(data); + buffer.put(ODurablePage.NEXT_FREE_POSITION, data); cachePointer.releaseExclusiveLock(); wowCache.store(fileId, i, cachePointer); @@ -311,11 +308,10 @@ public void testLoadStoreEncrypted() throws Exception { OCachePointer cachePointer = wowCache.load(fileId, i, new OModifiableBoolean(), true); byte[] dataTwo = new byte[8]; - ByteBuffer buffer = cachePointer.getBufferDuplicate(); + ByteBuffer buffer = cachePointer.getBuffer(); assert buffer != null; - buffer.position(ODurablePage.NEXT_FREE_POSITION); - buffer.get(dataTwo); + buffer.get(ODurablePage.NEXT_FREE_POSITION, dataTwo); cachePointer.decrementReadersReferrer(); Assert.assertArrayEquals(dataTwo, dataOne); @@ -328,11 +324,10 @@ public void testLoadStoreEncrypted() throws Exception { OCachePointer cachePointer = wowCache.load(fileId, i, new OModifiableBoolean(), true); byte[] dataTwo = new byte[8]; - ByteBuffer buffer = cachePointer.getBufferDuplicate(); + ByteBuffer buffer = cachePointer.getBuffer(); assert buffer != null; - buffer.position(ODurablePage.NEXT_FREE_POSITION); - buffer.get(dataTwo); + buffer.get(ODurablePage.NEXT_FREE_POSITION, dataTwo); cachePointer.decrementReadersReferrer(); Assert.assertArrayEquals(dataTwo, dataOne); @@ -381,14 +376,13 @@ public void testDataUpdate() throws Exception { final OCachePointer cachePointer = wowCache.load(fileId, pageIndex, new OModifiableBoolean(), false); cachePointer.acquireExclusiveLock(); - ByteBuffer buffer = cachePointer.getBufferDuplicate(); + ByteBuffer buffer = cachePointer.getBuffer(); assert buffer != null; Assert.assertEquals( new OLogSequenceNumber(0, 0), ODurablePage.getLogSequenceNumberFromPage(buffer)); - buffer.position(ODurablePage.NEXT_FREE_POSITION); - buffer.put(data); + buffer.put(ODurablePage.NEXT_FREE_POSITION, data); cachePointer.releaseExclusiveLock(); wowCache.store(fileId, pageIndex, cachePointer); @@ -401,11 +395,9 @@ public void testDataUpdate() throws Exception { OCachePointer cachePointer = wowCache.load(fileId, pageIndex, new OModifiableBoolean(), true); byte[] dataTwo = new byte[8]; - ByteBuffer buffer = cachePointer.getBufferDuplicate(); + ByteBuffer buffer = cachePointer.getBuffer(); assert buffer != null; - - buffer.position(ODurablePage.NEXT_FREE_POSITION); - buffer.get(dataTwo); + buffer.get(ODurablePage.NEXT_FREE_POSITION, dataTwo); cachePointer.decrementReadersReferrer(); Assert.assertArrayEquals(dataTwo, dataOne); @@ -425,11 +417,10 @@ public void testDataUpdate() throws Exception { wowCache.load(fileId, pageIndex, new OModifiableBoolean(), true); cachePointer.acquireExclusiveLock(); - ByteBuffer buffer = cachePointer.getBufferDuplicate(); + ByteBuffer buffer = cachePointer.getBuffer(); assert buffer != null; - buffer.position(ODurablePage.NEXT_FREE_POSITION); - buffer.put(data); + buffer.put(ODurablePage.NEXT_FREE_POSITION, data); cachePointer.releaseExclusiveLock(); wowCache.store(fileId, pageIndex, cachePointer); @@ -441,11 +432,10 @@ public void testDataUpdate() throws Exception { byte[] dataOne = entry.getValue(); OCachePointer cachePointer = wowCache.load(fileId, pageIndex, new OModifiableBoolean(), true); byte[] dataTwo = new byte[8]; - ByteBuffer buffer = cachePointer.getBufferDuplicate(); + ByteBuffer buffer = cachePointer.getBuffer(); assert buffer != null; - buffer.position(ODurablePage.NEXT_FREE_POSITION); - buffer.get(dataTwo); + buffer.get(ODurablePage.NEXT_FREE_POSITION, dataTwo); cachePointer.decrementReadersReferrer(); Assert.assertArrayEquals(dataTwo, dataOne); @@ -534,17 +524,16 @@ public void testDataUpdateEncrypted() throws Exception { final OCachePointer cachePointer = wowCache.load(fileId, pageIndex, new OModifiableBoolean(), verifyChecksums); - ByteBuffer bufferDuplicate = cachePointer.getBufferDuplicate(); + ByteBuffer bufferDuplicate = cachePointer.getBuffer(); assert bufferDuplicate != null; Assert.assertEquals( new OLogSequenceNumber(0, 0), ODurablePage.getLogSequenceNumberFromPage(bufferDuplicate)); cachePointer.acquireExclusiveLock(); - ByteBuffer buffer = cachePointer.getBufferDuplicate(); + ByteBuffer buffer = cachePointer.getBuffer(); - buffer.position(ODurablePage.NEXT_FREE_POSITION); - buffer.put(data); + buffer.put(ODurablePage.NEXT_FREE_POSITION, data); cachePointer.releaseExclusiveLock(); @@ -558,11 +547,10 @@ public void testDataUpdateEncrypted() throws Exception { OCachePointer cachePointer = wowCache.load(fileId, pageIndex, new OModifiableBoolean(), true); byte[] dataTwo = new byte[8]; - ByteBuffer buffer = cachePointer.getBufferDuplicate(); + ByteBuffer buffer = cachePointer.getBuffer(); assert buffer != null; - buffer.position(ODurablePage.NEXT_FREE_POSITION); - buffer.get(dataTwo); + buffer.get(ODurablePage.NEXT_FREE_POSITION, dataTwo); cachePointer.decrementReadersReferrer(); Assert.assertArrayEquals(dataTwo, dataOne); @@ -582,11 +570,10 @@ public void testDataUpdateEncrypted() throws Exception { wowCache.load(fileId, pageIndex, new OModifiableBoolean(), true); cachePointer.acquireExclusiveLock(); - ByteBuffer buffer = cachePointer.getBufferDuplicate(); + ByteBuffer buffer = cachePointer.getBuffer(); assert buffer != null; - buffer.position(ODurablePage.NEXT_FREE_POSITION); - buffer.put(data); + buffer.put(ODurablePage.NEXT_FREE_POSITION, data); cachePointer.releaseExclusiveLock(); @@ -599,11 +586,10 @@ public void testDataUpdateEncrypted() throws Exception { byte[] dataOne = entry.getValue(); OCachePointer cachePointer = wowCache.load(fileId, pageIndex, new OModifiableBoolean(), true); byte[] dataTwo = new byte[8]; - ByteBuffer buffer = cachePointer.getBufferDuplicate(); + ByteBuffer buffer = cachePointer.getBuffer(); assert buffer != null; - buffer.position(ODurablePage.NEXT_FREE_POSITION); - buffer.get(dataTwo); + buffer.get(ODurablePage.NEXT_FREE_POSITION, dataTwo); cachePointer.decrementReadersReferrer(); Assert.assertArrayEquals(dataTwo, dataOne); @@ -690,11 +676,10 @@ public void testChecksumFailure() throws IOException { final OCachePointer cachePointer = wowCache.load(fileId, 0, new OModifiableBoolean(), false); cachePointer.acquireExclusiveLock(); - final ByteBuffer buffer = cachePointer.getBufferDuplicate(); + final ByteBuffer buffer = cachePointer.getBuffer(); assert buffer != null; - buffer.position(ODurablePage.NEXT_FREE_POSITION); - buffer.put(new byte[buffer.remaining()]); + buffer.put(ODurablePage.NEXT_FREE_POSITION, new byte[buffer.remaining()]); cachePointer.releaseExclusiveLock(); wowCache.store(fileId, 0, cachePointer); @@ -730,11 +715,10 @@ public void testMagicFailure() throws IOException { final OCachePointer cachePointer = wowCache.load(fileId, 0, new OModifiableBoolean(), false); cachePointer.acquireExclusiveLock(); - final ByteBuffer buffer = cachePointer.getBufferDuplicate(); + final ByteBuffer buffer = cachePointer.getBuffer(); assert buffer != null; - buffer.position(ODurablePage.NEXT_FREE_POSITION); - buffer.put(new byte[buffer.remaining()]); + buffer.put(ODurablePage.NEXT_FREE_POSITION, new byte[buffer.remaining()]); cachePointer.releaseExclusiveLock(); wowCache.store(fileId, 0, cachePointer); @@ -768,11 +752,10 @@ public void testNoChecksumVerificationIfNotRequested() throws IOException { final OCachePointer cachePointer = wowCache.load(fileId, 0, new OModifiableBoolean(), false); cachePointer.acquireExclusiveLock(); - final ByteBuffer buffer = cachePointer.getBufferDuplicate(); + final ByteBuffer buffer = cachePointer.getBuffer(); assert buffer != null; - buffer.position(ODurablePage.NEXT_FREE_POSITION); - buffer.put(new byte[buffer.remaining()]); + buffer.put(ODurablePage.NEXT_FREE_POSITION, new byte[buffer.remaining()]); cachePointer.releaseExclusiveLock(); wowCache.store(fileId, 0, cachePointer); @@ -803,11 +786,10 @@ public void testNoChecksumFailureIfVerificationTurnedOff() throws IOException { final OCachePointer cachePointer = wowCache.load(fileId, 0, new OModifiableBoolean(), true); cachePointer.acquireExclusiveLock(); - final ByteBuffer buffer = cachePointer.getBufferDuplicate(); + final ByteBuffer buffer = cachePointer.getBuffer(); assert buffer != null; - buffer.position(ODurablePage.NEXT_FREE_POSITION); - buffer.put(new byte[buffer.remaining()]); + buffer.put(ODurablePage.NEXT_FREE_POSITION, new byte[buffer.remaining()]); cachePointer.releaseExclusiveLock(); wowCache.store(fileId, 0, cachePointer); @@ -838,11 +820,10 @@ public void testNoChecksumFailureIfVerificationTurnedOffOnLoad() throws IOExcept final OCachePointer cachePointer = wowCache.load(fileId, 0, new OModifiableBoolean(), true); cachePointer.acquireExclusiveLock(); - final ByteBuffer buffer = cachePointer.getBufferDuplicate(); + final ByteBuffer buffer = cachePointer.getBuffer(); assert buffer != null; - buffer.position(ODurablePage.NEXT_FREE_POSITION); - buffer.put(new byte[buffer.remaining()]); + buffer.put(ODurablePage.NEXT_FREE_POSITION, new byte[buffer.remaining()]); cachePointer.releaseExclusiveLock(); wowCache.store(fileId, 0, cachePointer); @@ -873,11 +854,10 @@ public void testNoChecksumFailureIfNoChecksumProvided() throws IOException { final OCachePointer cachePointer = wowCache.load(fileId, 0, new OModifiableBoolean(), true); cachePointer.acquireExclusiveLock(); - final ByteBuffer buffer = cachePointer.getBufferDuplicate(); + final ByteBuffer buffer = cachePointer.getBuffer(); assert buffer != null; - buffer.position(ODurablePage.NEXT_FREE_POSITION); - buffer.put(new byte[buffer.remaining()]); + buffer.put(ODurablePage.NEXT_FREE_POSITION, new byte[buffer.remaining()]); cachePointer.releaseExclusiveLock(); wowCache.store(fileId, 0, cachePointer); diff --git a/core/src/test/java/com/orientechnologies/orient/core/storage/index/hashindex/local/v3/OLocalHashTableV3WALTestIT.java b/core/src/test/java/com/orientechnologies/orient/core/storage/index/hashindex/local/v3/OLocalHashTableV3WALTestIT.java index 15583c16d85..dce488d6dd7 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/storage/index/hashindex/local/v3/OLocalHashTableV3WALTestIT.java +++ b/core/src/test/java/com/orientechnologies/orient/core/storage/index/hashindex/local/v3/OLocalHashTableV3WALTestIT.java @@ -227,7 +227,7 @@ private void assertFileRestoreFromWAL() throws IOException { databaseDocumentTx.activateOnCurrentThread(); databaseDocumentTx.close(); - actualStorage.close(true, false); + actualStorage.shutdown(); System.out.println("Start data restore"); restoreDataFromWAL(); @@ -250,7 +250,7 @@ private void assertFileRestoreFromWAL() throws IOException { expectedDatabaseDocumentTx.activateOnCurrentThread(); expectedDatabaseDocumentTx.close(); - expectedStorage.close(true, false); + expectedStorage.shutdown(); System.out.println("Start data comparison"); diff --git a/core/src/test/java/com/orientechnologies/orient/core/storage/index/sbtree/local/v1/SBTreeV1WALTestIT.java b/core/src/test/java/com/orientechnologies/orient/core/storage/index/sbtree/local/v1/SBTreeV1WALTestIT.java index 58f195ad116..e34871d066d 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/storage/index/sbtree/local/v1/SBTreeV1WALTestIT.java +++ b/core/src/test/java/com/orientechnologies/orient/core/storage/index/sbtree/local/v1/SBTreeV1WALTestIT.java @@ -237,7 +237,7 @@ private void assertFileRestoreFromWAL() throws IOException { databaseDocumentTx.activateOnCurrentThread(); databaseDocumentTx.close(); - actualStorage.close(true, false); + actualStorage.shutdown(); restoreDataFromWAL(); @@ -247,7 +247,7 @@ private void assertFileRestoreFromWAL() throws IOException { expectedDatabaseDocumentTx.activateOnCurrentThread(); expectedDatabaseDocumentTx.close(); - expectedStorage.close(true, false); + expectedStorage.shutdown(); assertFileContentIsTheSame(expectedSBTreeNativeFileName, nativeSBTreeFileName); } diff --git a/core/src/test/java/com/orientechnologies/orient/core/storage/index/sbtree/local/v2/SBTreeV2WALTestIT.java b/core/src/test/java/com/orientechnologies/orient/core/storage/index/sbtree/local/v2/SBTreeV2WALTestIT.java index 9a39ef0d3b4..9ff2d41bf67 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/storage/index/sbtree/local/v2/SBTreeV2WALTestIT.java +++ b/core/src/test/java/com/orientechnologies/orient/core/storage/index/sbtree/local/v2/SBTreeV2WALTestIT.java @@ -236,7 +236,7 @@ private void assertFileRestoreFromWAL() throws IOException { databaseDocumentTx.activateOnCurrentThread(); databaseDocumentTx.close(); - actualStorage.close(true, false); + actualStorage.shutdown(); restoreDataFromWAL(); @@ -246,7 +246,7 @@ private void assertFileRestoreFromWAL() throws IOException { expectedDatabaseDocumentTx.activateOnCurrentThread(); expectedDatabaseDocumentTx.close(); - expectedStorage.close(true, false); + expectedStorage.shutdown(); assertFileContentIsTheSame(expectedSBTreeNativeFileName, nativeSBTreeFileName); } diff --git a/core/src/test/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/IntSerializerTest.java b/core/src/test/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/IntSerializerTest.java index 3315f0e4436..c0a145b7f7c 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/IntSerializerTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/IntSerializerTest.java @@ -150,6 +150,13 @@ public void serializeByteBufferOneByteTest() { byteBufferSerializationTest(value); } + @Test + public void serializeImmutableByteBufferPositionOneByteTest() { + final int value = 0xE5; + + byteBufferImmutablePositionSerializationTest(value); + } + @Test public void serializeByteBufferTwoBytesTest() { final int value = 0xE4_E5; @@ -157,6 +164,13 @@ public void serializeByteBufferTwoBytesTest() { byteBufferSerializationTest(value); } + @Test + public void serializeImmutableByteBufferPositionTwoBytesTest() { + final int value = 0xE4_E5; + + byteBufferImmutablePositionSerializationTest(value); + } + @Test public void serializeByteBufferThreeBytesTest() { final int value = 0xA5_E4_E5; @@ -164,6 +178,13 @@ public void serializeByteBufferThreeBytesTest() { byteBufferSerializationTest(value); } + @Test + public void serializeImmutableByteBufferPositionThreeBytesTest() { + final int value = 0xA5_E4_E5; + + byteBufferImmutablePositionSerializationTest(value); + } + @Test public void serializeByteBufferFourBytesTest() { final int value = 0xFE_A5_E4_E5; @@ -171,6 +192,13 @@ public void serializeByteBufferFourBytesTest() { byteBufferSerializationTest(value); } + @Test + public void serializeImmutableByteBufferPositionFourBytesTest() { + final int value = 0xFE_A5_E4_E5; + + byteBufferImmutablePositionSerializationTest(value); + } + private void byteBufferSerializationTest(int value) { final IntSerializer serializer = new IntSerializer(); @@ -192,6 +220,28 @@ private void byteBufferSerializationTest(int value) { Assert.assertEquals(value, deserialized); } + private void byteBufferImmutablePositionSerializationTest(int value) { + final IntSerializer serializer = new IntSerializer(); + + final int size = serializer.getObjectSize(value); + final ByteBuffer byteBuffer = ByteBuffer.allocate(size + 3); + + byteBuffer.position(3); + + serializer.serializeInByteBufferObject(value, byteBuffer, (Object[]) null); + Assert.assertEquals(size + 3, byteBuffer.position()); + + byteBuffer.position(0); + final int serializedSize = serializer.getObjectSizeInByteBuffer(3, byteBuffer); + Assert.assertEquals(size, serializedSize); + Assert.assertEquals(0, byteBuffer.position()); + + final int deserialized = serializer.deserializeFromByteBufferObject(3, byteBuffer); + Assert.assertEquals(0, byteBuffer.position()); + + Assert.assertEquals(value, deserialized); + } + @Test public void serializeChangesOneByteTest() { final int value = 0xE5; @@ -238,5 +288,7 @@ private void changeTrackingSerializationTest(int value) { final int deserialized = serializer.deserializeFromByteBufferObject(byteBuffer, walChanges, 3); Assert.assertEquals(value, deserialized); + + Assert.assertEquals(0, byteBuffer.position()); } } diff --git a/core/src/test/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/btree/EdgeKeySerializerTest.java b/core/src/test/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/btree/EdgeKeySerializerTest.java index 36bfe1f8243..300de538122 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/btree/EdgeKeySerializerTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/storage/index/sbtreebonsai/global/btree/EdgeKeySerializerTest.java @@ -49,6 +49,30 @@ public void testBufferSerialization() { Assert.assertEquals(edgeKey, deserializedKey); } + @Test + public void testImmutableBufferPositionSerialization() { + final EdgeKey edgeKey = new EdgeKey(42, 24, 67); + final EdgeKeySerializer edgeKeySerializer = new EdgeKeySerializer(); + + final int serializedSize = edgeKeySerializer.getObjectSize(edgeKey); + final ByteBuffer buffer = ByteBuffer.allocate(serializedSize + 3); + + buffer.position(3); + edgeKeySerializer.serializeInByteBufferObject(edgeKey, buffer); + + Assert.assertEquals(3 + serializedSize, buffer.position()); + + buffer.position(0); + Assert.assertEquals(serializedSize, edgeKeySerializer.getObjectSizeInByteBuffer(3, buffer)); + + Assert.assertEquals(0, buffer.position()); + + final EdgeKey deserializedKey = edgeKeySerializer.deserializeFromByteBufferObject(3, buffer); + Assert.assertEquals(0, buffer.position()); + + Assert.assertEquals(edgeKey, deserializedKey); + } + @Test public void testChangesSerialization() { final EdgeKey edgeKey = new EdgeKey(42, 24, 67); diff --git a/core/src/test/java/com/orientechnologies/orient/core/tx/DuplicateDictionaryIndexChangesTxTest.java b/core/src/test/java/com/orientechnologies/orient/core/tx/DuplicateDictionaryIndexChangesTxTest.java index 189b68fc02f..3b48438cfab 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/tx/DuplicateDictionaryIndexChangesTxTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/tx/DuplicateDictionaryIndexChangesTxTest.java @@ -29,7 +29,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Sergey Sitnikov */ +/** + * @author Sergey Sitnikov + */ public class DuplicateDictionaryIndexChangesTxTest extends BaseMemoryDatabase { private OIndex index; diff --git a/core/src/test/java/com/orientechnologies/orient/core/tx/DuplicateNonUniqueIndexChangesTxTest.java b/core/src/test/java/com/orientechnologies/orient/core/tx/DuplicateNonUniqueIndexChangesTxTest.java index 33162be0ad7..4a6bcd8f8df 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/tx/DuplicateNonUniqueIndexChangesTxTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/tx/DuplicateNonUniqueIndexChangesTxTest.java @@ -34,7 +34,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Sergey Sitnikov */ +/** + * @author Sergey Sitnikov + */ public class DuplicateNonUniqueIndexChangesTxTest extends BaseMemoryDatabase { private OIndex index; diff --git a/core/src/test/java/com/orientechnologies/orient/core/tx/DuplicateUniqueIndexChangesTxTest.java b/core/src/test/java/com/orientechnologies/orient/core/tx/DuplicateUniqueIndexChangesTxTest.java index bbfb4f31f49..b5a62575003 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/tx/DuplicateUniqueIndexChangesTxTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/tx/DuplicateUniqueIndexChangesTxTest.java @@ -30,7 +30,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Sergey Sitnikov */ +/** + * @author Sergey Sitnikov + */ public class DuplicateUniqueIndexChangesTxTest extends BaseMemoryDatabase { private OIndex index; diff --git a/core/src/test/java/com/orientechnologies/orient/core/tx/ExternalCollectionsTest.java b/core/src/test/java/com/orientechnologies/orient/core/tx/ExternalCollectionsTest.java index 79d435022ff..67b9e5a29f9 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/tx/ExternalCollectionsTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/tx/ExternalCollectionsTest.java @@ -27,7 +27,9 @@ import org.junit.Ignore; import org.junit.Test; -/** @author Sergey Sitnikov */ +/** + * @author Sergey Sitnikov + */ public class ExternalCollectionsTest extends BaseMemoryDatabase { @Ignore // re-enable or remove after decision on #6370 is made diff --git a/core/src/test/java/com/orientechnologies/orient/core/tx/IndexChangesInterpretationTest.java b/core/src/test/java/com/orientechnologies/orient/core/tx/IndexChangesInterpretationTest.java index 7b52bdf4e15..ed7bcfd48b8 100644 --- a/core/src/test/java/com/orientechnologies/orient/core/tx/IndexChangesInterpretationTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/tx/IndexChangesInterpretationTest.java @@ -32,7 +32,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author Sergey Sitnikov */ +/** + * @author Sergey Sitnikov + */ public class IndexChangesInterpretationTest { // @formatter:off diff --git a/distributed/pom.xml b/distributed/pom.xml index 667de112755..cefe16971d2 100755 --- a/distributed/pom.xml +++ b/distributed/pom.xml @@ -43,6 +43,8 @@ UTF-8 NONE ${project.basedir}/../ + + 2023-01-01T00:00:00Z @@ -195,14 +197,6 @@ test - - org.slf4j - slf4j-simple - 2.0.6 - test - - - diff --git a/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/OClusterHealthChecker.java b/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/OClusterHealthChecker.java index 65f18029baa..897ddf91fa6 100755 --- a/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/OClusterHealthChecker.java +++ b/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/OClusterHealthChecker.java @@ -170,7 +170,8 @@ private void checkServerList() { manager.getLocalNodeName(), null, ODistributedServerLog.DIRECTION.NONE, - "Server '%s' was not found in the list of registered servers. Reloading configuration from cluster...", + "Server '%s' was not found in the list of registered servers. Reloading configuration" + + " from cluster...", server); ((ODistributedPlugin) manager).reloadRegisteredNodes(); @@ -193,7 +194,8 @@ private void checkServerList() { manager.getLocalNodeName(), null, ODistributedServerLog.DIRECTION.NONE, - "Server '%s' was not found in the list of registered servers after the update, restarting the server...", + "Server '%s' was not found in the list of registered servers after the update," + + " restarting the server...", server); try { @@ -243,7 +245,8 @@ private void checkServerStatus() { manager.getLocalNodeName(), null, ODistributedServerLog.DIRECTION.NONE, - "No server are ONLINE for database '%s'. Considering local copy of database as the good one. Setting status=ONLINE...", + "No server are ONLINE for database '%s'. Considering local copy of database as the good" + + " one. Setting status=ONLINE...", dbName); context.distributedSetOnline(dbName); @@ -415,7 +418,8 @@ private void setDatabaseOffline(final String dbName, final String server) { manager.getLocalNodeName(), server, ODistributedServerLog.DIRECTION.OUT, - "Server '%s' did not respond to the gossip message (db=%s, timeout=%dms). Setting the database as NOT_AVAILABLE", + "Server '%s' did not respond to the gossip message (db=%s, timeout=%dms). Setting the" + + " database as NOT_AVAILABLE", server, dbName, OGlobalConfiguration.DISTRIBUTED_HEARTBEAT_TIMEOUT.getValueAsLong()); @@ -429,7 +433,8 @@ private void setDatabaseOffline(final String dbName, final String server) { manager.getLocalNodeName(), server, ODistributedServerLog.DIRECTION.OUT, - "Server '%s' did not respond to the gossip message (db=%s, timeout=%dms), but cannot be set OFFLINE by configuration", + "Server '%s' did not respond to the gossip message (db=%s, timeout=%dms), but cannot be" + + " set OFFLINE by configuration", server, dbName, OGlobalConfiguration.DISTRIBUTED_HEARTBEAT_TIMEOUT.getValueAsLong()); diff --git a/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/ODatabaseDocumentDistributed.java b/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/ODatabaseDocumentDistributed.java index 6c34af6365f..1c980bac796 100755 --- a/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/ODatabaseDocumentDistributed.java +++ b/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/ODatabaseDocumentDistributed.java @@ -569,7 +569,8 @@ < getConfiguration().getValueAsInteger(DISTRIBUTED_CONCURRENT_TX_MAX_AUTORETRY)) OLogManager.instance() .debug( this, - "Allocation of rid not match, expected:%s actual:%s waiting for re-enqueue request", + "Allocation of rid not match, expected:%s actual:%s waiting for re-enqueue" + + " request", ex.getExpectedRid(), ex.getActualRid()); txContext.releasePromises(); @@ -587,7 +588,8 @@ < getConfiguration().getValueAsInteger(DISTRIBUTED_CONCURRENT_TX_MAX_AUTORETRY)) OLogManager.instance() .info( this, - "Persistent version not match, record:%s expected:%s actual:%s waiting for re-enqueue request", + "Persistent version not match, record:%s expected:%s actual:%s waiting for" + + " re-enqueue request", ex.getRid(), ex.getEnhancedRecordVersion(), ex.getEnhancedDatabaseVersion()); @@ -679,7 +681,8 @@ public boolean commit2pc( // This should not happen! throw new ODistributedException( String.format( - "Locks for tx '%s' are no longer valid in the second phase despite successful first phase", + "Locks for tx '%s' are no longer valid in the second phase despite successful" + + " first phase", transactionId)); } try { @@ -911,7 +914,8 @@ private void firstPhaseDataChecks( if (!oldValueRemoved) { throw new ORecordDuplicatedException( String.format( - "Cannot index record %s: found duplicated key '%s' in index '%s' previously assigned to the record %s", + "Cannot index record %s: found duplicated key '%s' in index '%s' previously" + + " assigned to the record %s", newValue, null, getName(), old.getIdentity()), getName(), old.getIdentity(), @@ -956,7 +960,8 @@ private void firstPhaseDataChecks( if (!oldValueRemoved) { throw new ORecordDuplicatedException( String.format( - "Cannot index record %s: found duplicated key '%s' in index '%s' previously assigned to the record %s", + "Cannot index record %s: found duplicated key '%s' in index '%s' previously" + + " assigned to the record %s", newValue, changesPerKey.key, getName(), old.getIdentity()), getName(), old.getIdentity(), @@ -1150,7 +1155,8 @@ private ODistributedTxResponseManagerImpl sendTask( ODistributedServerManager dManager = getDistributedManager(); final class HoldResponseManager { ODistributedTxResponseManagerImpl responseManager; - }; + } + ; final HoldResponseManager holder = new HoldResponseManager(); ((ODistributedPlugin) dManager) diff --git a/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/ODistributedOutput.java b/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/ODistributedOutput.java index 7a2ff48de6e..d1ee3af2862 100755 --- a/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/ODistributedOutput.java +++ b/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/ODistributedOutput.java @@ -238,7 +238,9 @@ public static String formatMessageBetweenServers( final StringBuilder buffer = new StringBuilder(); buffer.append( - "\nREPLICATION MESSAGE COUNTERS (servers: source on the row and destination on the column)"); + "\n" + + "REPLICATION MESSAGE COUNTERS (servers: source on the row and destination on the" + + " column)"); final OTableFormatter table = new OTableFormatter( new OTableFormatter.OTableOutput() { diff --git a/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/ODistributedPlugin.java b/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/ODistributedPlugin.java index bcc647a33f5..6633c0f8247 100644 --- a/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/ODistributedPlugin.java +++ b/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/ODistributedPlugin.java @@ -721,7 +721,8 @@ public ODistributedResponse send2Nodes( this.nodeName, node, DIRECTION.OUT, - "Error on sending distributed request %s. The target node is not available. Active nodes: %s", + "Error on sending distributed request %s. The target node is not available. Active" + + " nodes: %s", e, iRequest, getAvailableNodeNames(databaseName)); @@ -794,7 +795,8 @@ protected ODistributedResponse waitForResponse( this.nodeName, null, DIRECTION.IN, - "Timeout (%dms) on waiting for synchronous responses from nodes=%s responsesSoFar=%s request=(%s)", + "Timeout (%dms) on waiting for synchronous responses from nodes=%s responsesSoFar=%s" + + " request=(%s)", elapsed, currentResponseMgr.getExpectedNodes(), currentResponseMgr.getRespondingNodes(), @@ -1334,7 +1336,8 @@ public Boolean internalInstallDatabase( nodeName, null, DIRECTION.OUT, - "Current copy of database '%s' is newer than the copy present in the cluster. Use the local copy and force other nodes to download this", + "Current copy of database '%s' is newer than the copy present in the cluster. Use the" + + " local copy and force other nodes to download this", databaseName); databaseInstalled = true; @@ -1552,7 +1555,8 @@ protected boolean requestDatabaseFullSync( nodeName, null, DIRECTION.NONE, - "Cannot request full deploy of database '%s' because there are no nodes available with such database", + "Cannot request full deploy of database '%s' because there are no nodes available with" + + " such database", databaseName); return false; } @@ -1622,7 +1626,8 @@ protected boolean requestDatabaseFullSync( nodeName, selectedNodes.toString(), DIRECTION.IN, - "Timeout waiting the sync database please set the `distributed.deployDbTaskTimeout` to appropriate value"); + "Timeout waiting the sync database please set the `distributed.deployDbTaskTimeout` to" + + " appropriate value"); setDatabaseStatus(nodeName, databaseName, DB_STATUS.NOT_AVAILABLE); return false; } @@ -1730,7 +1735,8 @@ protected void backupCurrentDatabase(final String iDatabaseName) { nodeName, null, DIRECTION.NONE, - "Moving existent database '%s' in '%s' to '%s' and get a fresh copy from a remote node...", + "Moving existent database '%s' in '%s' to '%s' and get a fresh copy from a remote" + + " node...", iDatabaseName, dbpath, backupPath); @@ -2336,7 +2342,8 @@ public static String getListeningBinaryAddress(final ODocument cfg) { final Collection> listeners = cfg.field("listeners"); if (listeners == null) throw new ODatabaseException( - "Cannot connect to a remote node because bad distributed configuration: missing 'listeners' array field"); + "Cannot connect to a remote node because bad distributed configuration: missing" + + " 'listeners' array field"); String listenUrl = null; for (Map listener : listeners) { if ((listener.get("protocol")).equals("ONetworkProtocolBinary")) { @@ -2655,7 +2662,8 @@ public void removeServer(final String nodeLeftName, final boolean removeOnlyDyna nodeName, null, DIRECTION.NONE, - "Cannot re-balance the cluster for database '%s' because the Lock Manager is not available (err=%s)", + "Cannot re-balance the cluster for database '%s' because the Lock Manager is not" + + " available (err=%s)", databaseName, e.getMessage()); } diff --git a/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/metadata/OClassDistributed.java b/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/metadata/OClassDistributed.java index feb485c921b..1245ce867d4 100755 --- a/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/metadata/OClassDistributed.java +++ b/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/metadata/OClassDistributed.java @@ -596,7 +596,8 @@ public ODistributedConfiguration readConfiguration( manager.getLocalNodeName(), null, ODistributedServerLog.DIRECTION.NONE, - "Cannot find best cluster for class '%s'. Configured servers for clusters %s are %s (dCfgVersion=%d)", + "Cannot find best cluster for class '%s'. Configured servers for clusters %s are %s" + + " (dCfgVersion=%d)", getName(), clusterNames, buffer.toString(), diff --git a/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/task/OTransactionPhase1Task.java b/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/task/OTransactionPhase1Task.java index 19bdeaca498..9c7cb3f2b3d 100755 --- a/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/task/OTransactionPhase1Task.java +++ b/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/task/OTransactionPhase1Task.java @@ -63,7 +63,9 @@ import java.util.TimerTask; import java.util.TreeSet; -/** @author luigi dell'aquila (l.dellaquila - at - orientdb.com) */ +/** + * @author luigi dell'aquila (l.dellaquila - at - orientdb.com) + */ public class OTransactionPhase1Task extends OAbstractRemoteTask implements OLockKeySource { public static final int FACTORYID = 43; private volatile boolean hasResponse; diff --git a/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/task/OTransactionPhase1TaskResult.java b/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/task/OTransactionPhase1TaskResult.java index aa0d025ff2d..6931b4e4ff4 100644 --- a/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/task/OTransactionPhase1TaskResult.java +++ b/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/task/OTransactionPhase1TaskResult.java @@ -38,7 +38,9 @@ import java.io.DataOutput; import java.io.IOException; -/** @author tglman */ +/** + * @author tglman + */ public class OTransactionPhase1TaskResult implements OStreamable { private OTransactionResultPayload resultPayload; diff --git a/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/task/OTransactionPhase2Task.java b/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/task/OTransactionPhase2Task.java index cc85a15b526..d870609bf66 100644 --- a/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/task/OTransactionPhase2Task.java +++ b/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/task/OTransactionPhase2Task.java @@ -24,7 +24,9 @@ import java.util.SortedSet; import java.util.TreeSet; -/** @author Luigi Dell'Aquila (l.dellaquila - at - orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila - at - orientdb.com) + */ public class OTransactionPhase2Task extends OAbstractRemoteTask implements OLockKeySource { public static final int FACTORYID = 44; @@ -135,7 +137,8 @@ public Object execute( OLogManager.instance() .info( OTransactionPhase2Task.this, - "Received second phase but not yet first phase for commit tx:%s, re-enqueue second phase", + "Received second phase but not yet first phase for commit tx:%s, re-enqueue" + + " second phase", firstPhaseId); ((ODatabaseDocumentDistributed) database) .getDistributedShared() diff --git a/distributed/src/main/java/com/orientechnologies/orient/server/distributed/sql/ODistributedCommandExecutorSQLFactory.java b/distributed/src/main/java/com/orientechnologies/orient/server/distributed/sql/ODistributedCommandExecutorSQLFactory.java index 3edb2316c4f..de145c47457 100755 --- a/distributed/src/main/java/com/orientechnologies/orient/server/distributed/sql/ODistributedCommandExecutorSQLFactory.java +++ b/distributed/src/main/java/com/orientechnologies/orient/server/distributed/sql/ODistributedCommandExecutorSQLFactory.java @@ -68,7 +68,8 @@ public OCommandExecutorSQLAbstract createCommand(final String name) new OCommandExecutionException( "Error in creation of command " + name - + "(). Probably there is not an empty constructor or the constructor generates errors"), + + "(). Probably there is not an empty constructor or the constructor generates" + + " errors"), e); } } diff --git a/distributed/src/main/java/com/orientechnologies/orient/server/hazelcast/OHazelcastClusterMetadataManager.java b/distributed/src/main/java/com/orientechnologies/orient/server/hazelcast/OHazelcastClusterMetadataManager.java index fe8ba7d4dad..4ea0e35c354 100644 --- a/distributed/src/main/java/com/orientechnologies/orient/server/hazelcast/OHazelcastClusterMetadataManager.java +++ b/distributed/src/main/java/com/orientechnologies/orient/server/hazelcast/OHazelcastClusterMetadataManager.java @@ -681,7 +681,8 @@ public void entryAdded(final EntryEvent iEvent) { ODistributedServerLog.DIRECTION.IN, "Found a new node (%s) with the same name as current: '" + joinedNodeName - + "'. The node has been excluded. Change the name in its config/orientdb-dserver-config.xml file", + + "'. The node has been excluded. Change the name in its" + + " config/orientdb-dserver-config.xml file", iEvent.getMember()); throw new ODistributedException( @@ -689,7 +690,8 @@ public void entryAdded(final EntryEvent iEvent) { + iEvent.getMember().toString() + ") with the same name as current: '" + joinedNodeName - + "'. The node has been excluded. Change the name in its config/orientdb-dserver-config.xml file"); + + "'. The node has been excluded. Change the name in its" + + " config/orientdb-dserver-config.xml file"); } registerNode(iEvent.getMember(), joinedNodeName); @@ -1113,7 +1115,8 @@ public boolean removeNodeFromConfiguration( nodeName, null, ODistributedServerLog.DIRECTION.NONE, - "Cannot remove server '%s' because it is enlisted in data center '%s' configuration for database '%s'", + "Cannot remove server '%s' because it is enlisted in data center '%s' configuration for" + + " database '%s'", nodeLeftName, dc, databaseName); @@ -1128,7 +1131,8 @@ public boolean removeNodeFromConfiguration( nodeName, null, ODistributedServerLog.DIRECTION.NONE, - "Cannot remove server '%s' because it is enlisted in 'servers' of the distributed configuration for database '%s'", + "Cannot remove server '%s' because it is enlisted in 'servers' of the distributed" + + " configuration for database '%s'", nodeLeftName, databaseName); return false; @@ -1232,7 +1236,8 @@ public void run() { nodeName, null, ODistributedServerLog.DIRECTION.NONE, - "Removed node id=%s name=%s has not being recognized. Remove the node manually (registeredNodes=%s)", + "Removed node id=%s name=%s has not being recognized. Remove the node manually" + + " (registeredNodes=%s)", member, nodeLeftName, registeredNodes); diff --git a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/AbstractDistributedWriteTest.java b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/AbstractDistributedWriteTest.java index 96281b6ca54..dab6c4bd6d2 100755 --- a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/AbstractDistributedWriteTest.java +++ b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/AbstractDistributedWriteTest.java @@ -40,6 +40,7 @@ public abstract class AbstractDistributedWriteTest extends AbstractServerCluster protected int writerCount = 5; protected volatile int count = 100; protected CountDownLatch runningWriters; + // protected final OPartitionedDatabasePoolFactory poolFactory = new // OPartitionedDatabasePoolFactory(); diff --git a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/DistributedConfigReloadIT.java b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/DistributedConfigReloadIT.java index dbeec29856c..8271bbf6f51 100644 --- a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/DistributedConfigReloadIT.java +++ b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/DistributedConfigReloadIT.java @@ -175,7 +175,8 @@ public void run() { + id + "] Caught [" + e - + "] during reload because the record was already deleted, no errors just go ahead"); + + "] during reload because the record was already deleted, no" + + " errors just go ahead"); } } catch (ORecordNotFoundException e) { // BY LUCA @@ -184,7 +185,8 @@ public void run() { + id + "] Caught [" + e - + "] because the record was already deleted, no errors just go ahead"); + + "] because the record was already deleted, no errors just go" + + " ahead"); } catch (Exception ex) { log( "[" @@ -293,7 +295,8 @@ public void run() { log( "[" + id - + "] ODistributedConfigurationChangedException {} while updating vertex " + + "] ODistributedConfigurationChangedException {} while updating" + + " vertex " + vertex); } } catch (ORecordDuplicatedException ex) { @@ -311,7 +314,8 @@ public void run() { log( "[" + id - + "] ODistributedConfigurationChangedException {} while updating vertex " + + "] ODistributedConfigurationChangedException {} while updating" + + " vertex " + vertex); } } catch (Exception ex) { @@ -351,7 +355,9 @@ public static final void log(String message, Throwable th) { th.printStackTrace(); } - /** @return */ + /** + * @return + */ private static String getDate() { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return formatter.format(new Date()); @@ -359,7 +365,9 @@ private static String getDate() { private ODatabasePool graphReadFactory; - /** @return */ + /** + * @return + */ public String getDBURL() { String dataBaseURL = System.getProperty("db.url", "localhost:2424;localhost:2425;localhost:2426"); diff --git a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/DistributedDatabaseCRUDIT.java b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/DistributedDatabaseCRUDIT.java index bb67d43c44d..0ca8001b08f 100644 --- a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/DistributedDatabaseCRUDIT.java +++ b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/DistributedDatabaseCRUDIT.java @@ -266,11 +266,11 @@ public void run() { String sql = "Update TestNode set prop5='" + String.valueOf(System.currentTimeMillis()) - + "'" - + ", prop-7='value7-1', prop-8='value8-1', prop-9='value9-1',prop-10='value10-1', prop11='value11-1'" - + ", prop-07='value07-1', prop-08='value08-1', prop-09='value09-1',prop-010='value010-1', prop011='value011-1'" - + ", prop12='vaue12-1', prop13='value13-1'" - + ", updateTime='" + + "', prop-7='value7-1', prop-8='value8-1'," + + " prop-9='value9-1',prop-10='value10-1', prop11='value11-1'," + + " prop-07='value07-1', prop-08='value08-1'," + + " prop-09='value09-1',prop-010='value010-1', prop011='value011-1'," + + " prop12='vaue12-1', prop13='value13-1', updateTime='" + new Date().toString() + "' where property4='" + propertyValue @@ -505,7 +505,9 @@ public void run() { // --------------------------------------------------------------- // ---------------------------------------------------------------------------------------------------------------- - /** @return */ + /** + * @return + */ public String getDBURL() { return "remote:" + "localhost:2424;localhost:2425;localhost:2426" + "/" + dbName; } @@ -634,7 +636,9 @@ public static final void log(String message, Throwable th) { th.printStackTrace(); } - /** @return */ + /** + * @return + */ private static String getDate() { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return formatter.format(new Date()); diff --git a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/DistributedIndexesIT.java b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/DistributedIndexesIT.java index 389537dd0bb..fffe9eff8f7 100755 --- a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/DistributedIndexesIT.java +++ b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/DistributedIndexesIT.java @@ -28,7 +28,9 @@ * */ -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class DistributedIndexesIT extends AbstractServerClusterTest { private static final int SERVERS = 2; @@ -87,10 +89,12 @@ private void testIndexUsage(ODatabaseDocument db) { "CREATE INDEX index_dictionary ON DistributedIndexTest (dictionary) DICTIONARY") .close(); db.command( - "CREATE INDEX index_unique_hash ON DistributedIndexTest (unique_hash) UNIQUE_HASH_INDEX") + "CREATE INDEX index_unique_hash ON DistributedIndexTest (unique_hash)" + + " UNIQUE_HASH_INDEX") .close(); db.command( - "CREATE INDEX index_notunique_hash ON DistributedIndexTest (notunique_hash) NOTUNIQUE_HASH_INDEX") + "CREATE INDEX index_notunique_hash ON DistributedIndexTest (notunique_hash)" + + " NOTUNIQUE_HASH_INDEX") .close(); final ODocument test1 = new ODocument("DistributedIndexTest"); diff --git a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/HaRemoveServerIT.java b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/HaRemoveServerIT.java index 76ecd8759c9..726d98ebb2e 100644 --- a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/HaRemoveServerIT.java +++ b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/HaRemoveServerIT.java @@ -33,7 +33,9 @@ * */ -/** @author Enrico Risa */ +/** + * @author Enrico Risa + */ public class HaRemoveServerIT extends AbstractServerClusterTest { private static final int SERVERS = 2; diff --git a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/HaSyncClusterIT.java b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/HaSyncClusterIT.java index db65c793b2f..b56d3770b10 100644 --- a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/HaSyncClusterIT.java +++ b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/HaSyncClusterIT.java @@ -163,7 +163,8 @@ public Boolean call(Void iArgument) { OLogManager.instance() .info( this, - "Waiting for processed requests to be [%d], actual [%d] with stats [%s] ", + "Waiting for processed requests to be [%d], actual [%d] with" + + " stats [%s] ", NUM_RECORDS, processed, messageStats.toJSON()); diff --git a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/OrientdbEdgeIT.java b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/OrientdbEdgeIT.java index e5f80dbd8b6..31218d6a9a4 100755 --- a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/OrientdbEdgeIT.java +++ b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/OrientdbEdgeIT.java @@ -137,19 +137,22 @@ public static void setup() throws Exception { + " \n" + " \n" + " \n" - + " \n" + + " " + + " value=\"src/test/resources/default-distributed-db-config.json\"/>\n" + + " \n" + "\n" + " \n" - + " " - + " \n" + + " \n" + " \n" + " \n" + " \n" + + " " + + " implementation=\"com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary\"/>\n" + " \n" + " \n" - + " \n" + + " \n" + " \n" + " \n" + " \n" @@ -161,12 +164,14 @@ public static void setup() throws Exception { + " \n" + " \n" + "\n" - + "" - + " \n" + + " \n" + " \n" + " \n" + "\n" - + " \n" + + " \n" + " \n" + " \n" + " \n" diff --git a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/ShardingDocsAndEdgesIT.java b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/ShardingDocsAndEdgesIT.java index f06e77119e7..0b650c903ce 100644 --- a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/ShardingDocsAndEdgesIT.java +++ b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/ShardingDocsAndEdgesIT.java @@ -120,7 +120,8 @@ protected void executeTest() throws Exception { // LINE A execute( USA, - "create edge Follows from (select from `Client-Type` where name = 'mike') to (select from `Client-Type` where name = 'phoebe')"); + "create edge Follows from (select from `Client-Type` where name = 'mike') to (select from" + + " `Client-Type` where name = 'phoebe')"); USA.close(); EUR.close(); } diff --git a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/StandAloneDatabaseJavaThreadPoolTest.java b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/StandAloneDatabaseJavaThreadPoolTest.java index c6f5ebd0114..4d4a024dff6 100644 --- a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/StandAloneDatabaseJavaThreadPoolTest.java +++ b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/StandAloneDatabaseJavaThreadPoolTest.java @@ -32,7 +32,9 @@ public StandAloneDatabaseJavaThreadPoolTest(String dbName) { checkAndCreateDatabase(dbName); } - /** @return */ + /** + * @return + */ private ExecutorService getExecutorService() { if (executorService == null) { executorService = Executors.newFixedThreadPool(10); @@ -333,7 +335,9 @@ public void printVertex(String info, OElement vtx) { } } - /** @return */ + /** + * @return + */ public String getDBURL() { return "remote:" + "localhost:2424;localhost:2425;localhost:2426" + "/" + dbName; } diff --git a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/asynch/AsyncIndexIT.java b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/asynch/AsyncIndexIT.java index c13f532ad17..e68b5d98c90 100644 --- a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/asynch/AsyncIndexIT.java +++ b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/asynch/AsyncIndexIT.java @@ -36,12 +36,14 @@ protected void dbClient1(BareBonesServer[] servers) { graph .command( - "insert into sms (type, lang, source, content) values ( 'notify', 'en', 1, 'This is a test')") + "insert into sms (type, lang, source, content) values ( 'notify', 'en', 1, 'This is a" + + " test')") .close(); try { graph .command( - "insert into sms (type, lang, source, content) values ( 'notify', 'en', 1, 'This is a test')") + "insert into sms (type, lang, source, content) values ( 'notify', 'en', 1, 'This is" + + " a test')") .close(); Assert.fail("violated unique index was not raised"); } catch (ORecordDuplicatedException e) { @@ -69,7 +71,8 @@ protected void dbClient1(BareBonesServer[] servers) { try { graph2 .command( - "insert into sms (type, lang, source, content) values ( 'notify', 'en', 1, 'This is a test')") + "insert into sms (type, lang, source, content) values ( 'notify', 'en', 1, 'This is" + + " a test')") .close(); Assert.fail("violated unique index was not raised"); } catch (ORecordDuplicatedException e) { diff --git a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/asynch/AsyncIndexRemoteIT.java b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/asynch/AsyncIndexRemoteIT.java index 803d7ad9a9d..d14c62bdd2e 100644 --- a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/asynch/AsyncIndexRemoteIT.java +++ b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/asynch/AsyncIndexRemoteIT.java @@ -31,12 +31,14 @@ protected void dbClient1(BareBonesServer[] servers) { graph .command( - "insert into sms (type, lang, source, content) values ( 'notify', 'en', 1, 'This is a test')") + "insert into sms (type, lang, source, content) values ( 'notify', 'en', 1, 'This is a" + + " test')") .close(); try { graph .command( - "insert into sms (type, lang, source, content) values ( 'notify', 'en', 1, 'This is a test')") + "insert into sms (type, lang, source, content) values ( 'notify', 'en', 1, 'This is" + + " a test')") .close(); Assert.fail("violated unique index was not raised"); } catch (ORecordDuplicatedException e) { @@ -65,7 +67,8 @@ protected void dbClient1(BareBonesServer[] servers) { try { graph2 .command( - "insert into sms (type, lang, source, content) values ( 'notify', 'en', 1, 'This is a test')") + "insert into sms (type, lang, source, content) values ( 'notify', 'en', 1, 'This is" + + " a test')") .close(); Assert.fail("violated unique index was not raised"); } catch (ORecordDuplicatedException e) { @@ -93,7 +96,8 @@ protected void dbClient1(BareBonesServer[] servers) { try { graph3 .command( - "insert into sms (type, lang, source, content) values ( 'notify', 'en', 1, 'This is a test')") + "insert into sms (type, lang, source, content) values ( 'notify', 'en', 1, 'This is" + + " a test')") .close(); Assert.fail("violated unique index was not raised"); } catch (ORecordDuplicatedException e) { diff --git a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/scenariotest/AbstractScenarioTest.java b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/scenariotest/AbstractScenarioTest.java index 5f2a63a4bc1..a01b289b960 100755 --- a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/scenariotest/AbstractScenarioTest.java +++ b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/scenariotest/AbstractScenarioTest.java @@ -432,7 +432,8 @@ public Boolean call(Void iArgument) { OLogManager.instance() .info( this, - "Waiting for updated document propagation on record %s. Found %s=%s, expected %s", + "Waiting for updated document propagation on record %s. Found %s=%s, expected" + + " %s", recordId, fieldName, storedValue, diff --git a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/scenariotest/ShutdownAndRestartNodeScenarioIT.java b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/scenariotest/ShutdownAndRestartNodeScenarioIT.java index 57b77f61838..51c374418a0 100755 --- a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/scenariotest/ShutdownAndRestartNodeScenarioIT.java +++ b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/scenariotest/ShutdownAndRestartNodeScenarioIT.java @@ -258,7 +258,8 @@ public Void call() throws Exception { System.out.println("Done.\n"); System.out.print( - "Checking the last record wasn't inserted in the db because the quorum was not reached..."); + "Checking the last record wasn't inserted in the db because the quorum was not" + + " reached..."); try (OResultSet result = dbServer1.query("select from Person where id='L-001'")) { assertEquals(0, result.stream().count()); } diff --git a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/scenariotest/WWConflictAndNodeInDeadlockScenarioIT.java b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/scenariotest/WWConflictAndNodeInDeadlockScenarioIT.java index a743db68ed8..2bef2eadc2c 100755 --- a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/scenariotest/WWConflictAndNodeInDeadlockScenarioIT.java +++ b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/scenariotest/WWConflictAndNodeInDeadlockScenarioIT.java @@ -124,7 +124,8 @@ public void executeTest() throws Exception { // inserting record r1 and checking consistency on server1 and server2 System.out.print( - "Inserting record r1 and on server1 and checking consistency on both server1 and server2..."); + "Inserting record r1 and on server1 and checking consistency on both server1 and" + + " server2..."); dbServer1.activateOnCurrentThread(); ODocument r1onServer1 = new ODocument("Person").fields("id", "R001", "firstName", "Han", "lastName", "Solo"); diff --git a/distribution/pom.xml b/distribution/pom.xml index 8a78a8cafcb..31103d6ff63 100755 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -29,6 +29,8 @@ ${project.version} ${implementation.build} UTF-8 + + 2023-01-01T00:00:00Z @@ -84,7 +86,7 @@ com.orientechnologies orientdb-studio - ${project.version} + 3.2.26 zip diff --git a/distribution/src/test/java/com/orientechnologies/distribution/integration/OGitHubIssuesIT.java b/distribution/src/test/java/com/orientechnologies/distribution/integration/OGitHubIssuesIT.java index 19717a76fe3..9c19691722a 100755 --- a/distribution/src/test/java/com/orientechnologies/distribution/integration/OGitHubIssuesIT.java +++ b/distribution/src/test/java/com/orientechnologies/distribution/integration/OGitHubIssuesIT.java @@ -73,37 +73,43 @@ public void Issue7264() throws Exception { results = db.query( - "SELECT FROM CaseSensitiveCollationIndex WHERE Version='1' AND `Group` = '1' AND Name='abc'"); + "SELECT FROM CaseSensitiveCollationIndex WHERE Version='1' AND `Group` = '1' AND" + + " Name='abc'"); assertThat(results).hasSize(1); results.close(); results = db.query( - "SELECT FROM CaseSensitiveCollationIndex WHERE Version='1' AND Name='abc' AND `Group` = '1'"); + "SELECT FROM CaseSensitiveCollationIndex WHERE Version='1' AND Name='abc' AND `Group` =" + + " '1'"); assertThat(results).hasSize(1); results.close(); results = db.query( - "SELECT FROM CaseSensitiveCollationIndex WHERE `Group` = '1' AND Name='abc' AND Version='1'"); + "SELECT FROM CaseSensitiveCollationIndex WHERE `Group` = '1' AND Name='abc' AND" + + " Version='1'"); assertThat(results).hasSize(1); results.close(); results = db.query( - "SELECT FROM CaseSensitiveCollationIndex WHERE `Group` = '1' AND Version='1' AND Name='abc'"); + "SELECT FROM CaseSensitiveCollationIndex WHERE `Group` = '1' AND Version='1' AND" + + " Name='abc'"); assertThat(results).hasSize(1); results.close(); results = db.query( - "SELECT FROM CaseSensitiveCollationIndex WHERE Name='abc' AND Version='1' AND `Group` = '1'"); + "SELECT FROM CaseSensitiveCollationIndex WHERE Name='abc' AND Version='1' AND `Group` =" + + " '1'"); assertThat(results).hasSize(1); results.close(); results = db.query( - "SELECT FROM CaseSensitiveCollationIndex WHERE Name='abc' AND `Group` = '1' AND Version='1'"); + "SELECT FROM CaseSensitiveCollationIndex WHERE Name='abc' AND `Group` = '1' AND" + + " Version='1'"); assertThat(results).hasSize(1); results.close(); @@ -138,45 +144,52 @@ public void Issue7264() throws Exception { results = db.query( - "SELECT FROM CaseInsensitiveCollationIndex WHERE Version='1' AND `Group` = '1' AND Name='abc'"); + "SELECT FROM CaseInsensitiveCollationIndex WHERE Version='1' AND `Group` = '1' AND" + + " Name='abc'"); assertThat(results).hasSize(8); results.close(); results = db.query( - "SELECT FROM CaseInsensitiveCollationIndex WHERE Version='1' AND Name='abc' AND `Group` = '1'"); + "SELECT FROM CaseInsensitiveCollationIndex WHERE Version='1' AND Name='abc' AND `Group`" + + " = '1'"); assertThat(results).hasSize(8); results.close(); results = db.query( - "SELECT FROM CaseInsensitiveCollationIndex WHERE `Group` = '1' AND Name='abc' AND Version='1'"); + "SELECT FROM CaseInsensitiveCollationIndex WHERE `Group` = '1' AND Name='abc' AND" + + " Version='1'"); assertThat(results).hasSize(8); results.close(); results = db.query( - "SELECT FROM CaseInsensitiveCollationIndex WHERE `Group` = '1' AND Version='1' AND Name='abc'"); + "SELECT FROM CaseInsensitiveCollationIndex WHERE `Group` = '1' AND Version='1' AND" + + " Name='abc'"); assertThat(results).hasSize(8); results.close(); results = db.query( - "SELECT FROM CaseInsensitiveCollationIndex WHERE Name='abc' AND Version='1' AND `Group` = '1'"); + "SELECT FROM CaseInsensitiveCollationIndex WHERE Name='abc' AND Version='1' AND `Group`" + + " = '1'"); assertThat(results).hasSize(8); results.close(); results = db.query( - "SELECT FROM CaseInsensitiveCollationIndex WHERE Name='abc' AND `Group` = '1' AND Version='1'"); + "SELECT FROM CaseInsensitiveCollationIndex WHERE Name='abc' AND `Group` = '1' AND" + + " Version='1'"); assertThat(results).hasSize(8); results.close(); // test that Group = 1 (integer) is correctly converted to String results = db.query( - "SELECT FROM CaseInsensitiveCollationIndex WHERE Name='abc' AND `Group` = 1 AND Version='1'"); + "SELECT FROM CaseInsensitiveCollationIndex WHERE Name='abc' AND `Group` = 1 AND" + + " Version='1'"); assertThat(results).hasSize(8); results.close(); } @@ -195,17 +208,22 @@ public void Issue7249() throws Exception { db.command("INSERT INTO t7249Profiles SET Name = 'Enrico';"); db.command( - "CREATE EDGE t7249HasFriend FROM (SELECT FROM t7249Profiles WHERE Name='Santo') TO (SELECT FROM t7249Profiles WHERE Name='Luca');"); + "CREATE EDGE t7249HasFriend FROM (SELECT FROM t7249Profiles WHERE Name='Santo') TO (SELECT" + + " FROM t7249Profiles WHERE Name='Luca');"); db.command( - "CREATE EDGE t7249HasFriend FROM (SELECT FROM t7249Profiles WHERE Name='Santo') TO (SELECT FROM t7249Profiles WHERE Name='Luigi');"); + "CREATE EDGE t7249HasFriend FROM (SELECT FROM t7249Profiles WHERE Name='Santo') TO (SELECT" + + " FROM t7249Profiles WHERE Name='Luigi');"); db.command( - "CREATE EDGE t7249HasFriend FROM (SELECT FROM t7249Profiles WHERE Name='Santo') TO (SELECT FROM t7249Profiles WHERE Name='Colin');"); + "CREATE EDGE t7249HasFriend FROM (SELECT FROM t7249Profiles WHERE Name='Santo') TO (SELECT" + + " FROM t7249Profiles WHERE Name='Colin');"); db.command( - "CREATE EDGE t7249HasFriend FROM (SELECT FROM t7249Profiles WHERE Name='Enrico') TO (SELECT FROM t7249Profiles WHERE Name='Santo');"); + "CREATE EDGE t7249HasFriend FROM (SELECT FROM t7249Profiles WHERE Name='Enrico') TO (SELECT" + + " FROM t7249Profiles WHERE Name='Santo');"); OResultSet rs = db.query( - "SELECT in('t7249HasFriend').size() as InFriendsNumber FROM t7249Profiles WHERE Name='Santo'"); + "SELECT in('t7249HasFriend').size() as InFriendsNumber FROM t7249Profiles WHERE" + + " Name='Santo'"); List results = rs.stream().collect(Collectors.toList()); rs.close(); @@ -214,7 +232,8 @@ public void Issue7249() throws Exception { rs = db.query( - "SELECT out('t7249HasFriend').size() as OutFriendsNumber FROM t7249Profiles WHERE Name='Santo'"); + "SELECT out('t7249HasFriend').size() as OutFriendsNumber FROM t7249Profiles WHERE" + + " Name='Santo'"); results = rs.stream().collect(Collectors.toList()); rs.close(); @@ -223,7 +242,8 @@ public void Issue7249() throws Exception { rs = db.query( - "SELECT both('t7249HasFriend').size() as TotalFriendsNumber FROM t7249Profiles WHERE Name='Santo'"); + "SELECT both('t7249HasFriend').size() as TotalFriendsNumber FROM t7249Profiles WHERE" + + " Name='Santo'"); results = rs.stream().collect(Collectors.toList()); rs.close(); @@ -250,19 +270,24 @@ public void Issue7256() throws Exception { db.command("INSERT INTO t7265Customers SET OrderedId = 1, Phone = '+1400844724';"); db.command("INSERT INTO t7265Hotels SET Id = 1, Name = 'Best Western Ascott', Type = 'hotel';"); db.command( - "INSERT INTO t7265Restaurants SET Id = 1, Name = 'La Brasserie de Milan', Type = 'restaurant';"); + "INSERT INTO t7265Restaurants SET Id = 1, Name = 'La Brasserie de Milan', Type =" + + " 'restaurant';"); db.command("INSERT INTO t7265Countries SET Id = 1, Code = 'AD', Name = 'Andorra';"); db.command( - "CREATE EDGE t7265HasEaten FROM (SELECT FROM t7265Customers WHERE OrderedId=1) TO (SELECT FROM t7265Restaurants WHERE Id=1);"); + "CREATE EDGE t7265HasEaten FROM (SELECT FROM t7265Customers WHERE OrderedId=1) TO (SELECT" + + " FROM t7265Restaurants WHERE Id=1);"); db.command( - "CREATE EDGE t7265HasStayed FROM (SELECT FROM t7265Customers WHERE OrderedId=1) TO (SELECT FROM t7265Hotels WHERE Id=1);"); + "CREATE EDGE t7265HasStayed FROM (SELECT FROM t7265Customers WHERE OrderedId=1) TO (SELECT" + + " FROM t7265Hotels WHERE Id=1);"); db.command( - "CREATE EDGE t7265IsFromCountry FROM (SELECT FROM t7265Customers WHERE OrderedId=1) TO (SELECT FROM t7265Countries WHERE Id=1);"); + "CREATE EDGE t7265IsFromCountry FROM (SELECT FROM t7265Customers WHERE OrderedId=1) TO" + + " (SELECT FROM t7265Countries WHERE Id=1);"); OResultSet results = db.query( - "MATCH {class: t7265Customers, as: customer, where: (OrderedId=1)}--{Class: t7265Services, as: service} RETURN service.Name"); + "MATCH {class: t7265Customers, as: customer, where: (OrderedId=1)}--{Class:" + + " t7265Services, as: service} RETURN service.Name"); assertThat(results).hasSize(2); results.close(); diff --git a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationAttractionsIT.java b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationAttractionsIT.java index 62b6bc73275..bb0f6a91f25 100755 --- a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationAttractionsIT.java +++ b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationAttractionsIT.java @@ -15,7 +15,8 @@ public class ODemoDbFromDocumentationAttractionsIT extends OIntegrationTestTempl public void test_Attractions_Example_1() throws Exception { OResultSet resultSet = db.query( - "MATCH {class: Customers, as: customer, where: (OrderedId=1)}--{Class: Attractions, as: attraction}\n" + "MATCH {class: Customers, as: customer, where: (OrderedId=1)}--{Class: Attractions, as:" + + " attraction}\n" + "RETURN $pathelements"); final List results = resultSet.stream().collect(Collectors.toList()); diff --git a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationBusinessOpportunitiesIT.java b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationBusinessOpportunitiesIT.java index afa2e87d031..34ff7b9be0d 100755 --- a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationBusinessOpportunitiesIT.java +++ b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationBusinessOpportunitiesIT.java @@ -26,7 +26,9 @@ public void test_BusinessOpportunities_Example_1() throws Exception { + "FROM (\n" + " SELECT expand(customerFriend) \n" + " FROM (\n" - + " MATCH {Class:Customers, as: customer, where:(OrderedId=1)}-HasProfile-{Class:Profiles, as: profile}-HasFriend-{Class:Profiles, as: customerFriend} RETURN customerFriend\n" + + " MATCH {Class:Customers, as: customer," + + " where:(OrderedId=1)}-HasProfile-{Class:Profiles, as:" + + " profile}-HasFriend-{Class:Profiles, as: customerFriend} RETURN customerFriend\n" + " )\n" + ") \n" + "WHERE in('HasProfile').size()=0\n" @@ -52,7 +54,8 @@ public void test_BusinessOpportunities_Example_2() throws Exception { + " SELECT expand(customerFriend) \n" + " FROM ( \n" + " MATCH \n" - + " {Class:Customers, as: customer}-HasProfile-{Class:Profiles, as: profile}-HasFriend-{Class:Profiles, as: customerFriend} \n" + + " {Class:Customers, as: customer}-HasProfile-{Class:Profiles, as:" + + " profile}-HasFriend-{Class:Profiles, as: customerFriend} \n" + " RETURN customerFriend\n" + " )\n" + ") \n" diff --git a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationCustomersIT.java b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationCustomersIT.java index b918b086792..1a20e480958 100755 --- a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationCustomersIT.java +++ b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationCustomersIT.java @@ -47,7 +47,8 @@ public void test_Customers_Example_3() throws Exception { OResultSet resultSet = db.query( - "MATCH {class: Customers, as: c, where: (OrderedId=1)}--{class: Locations, as: loc}-HasReview->{class: Reviews, as: r, optional: true} \n" + "MATCH {class: Customers, as: c, where: (OrderedId=1)}--{class: Locations, as:" + + " loc}-HasReview->{class: Reviews, as: r, optional: true} \n" + "RETURN $pathelements"); final List results = resultSet.stream().collect(Collectors.toList()); @@ -61,7 +62,8 @@ public void test_Customers_Example_4() throws Exception { OResultSet resultSet = db.query( - "MATCH {class: Customers, as: customer, where: (OrderedId=1)}--{class: Locations, as: loc}--{class: Customers, as: otherCustomers, where: (OrderedId<>1)} \n" + "MATCH {class: Customers, as: customer, where: (OrderedId=1)}--{class: Locations, as:" + + " loc}--{class: Customers, as: otherCustomers, where: (OrderedId<>1)} \n" + "RETURN $pathelements"); final List results = resultSet.stream().collect(Collectors.toList()); @@ -126,7 +128,8 @@ public void test_Customers_Example_8() throws Exception { OResultSet resultSet = db.query( - "MATCH {class: Customers, as: c, where: (OrderedId=1)}<-HasCustomer-{class: Orders, as: o} \n" + "MATCH {class: Customers, as: c, where: (OrderedId=1)}<-HasCustomer-{class: Orders, as:" + + " o} \n" + "RETURN $pathelements"); final List results = resultSet.stream().collect(Collectors.toList()); diff --git a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationFriendshipIT.java b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationFriendshipIT.java index e4ea22125f4..05401c29028 100755 --- a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationFriendshipIT.java +++ b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationFriendshipIT.java @@ -18,7 +18,8 @@ public void test_Friendship_Example_1() throws Exception { OResultSet resultSet = db.query( - "MATCH {Class: Profiles, as: profile, where: (Name='Santo' AND Surname='OrientDB')}-HasFriend-{Class: Profiles, as: friend} \n" + "MATCH {Class: Profiles, as: profile, where: (Name='Santo' AND" + + " Surname='OrientDB')}-HasFriend-{Class: Profiles, as: friend} \n" + "RETURN $pathelements"); Assert.assertEquals(resultSet.stream().count(), 20); @@ -45,7 +46,9 @@ public void test_Friendship_Example_2() throws Exception { OResultSet resultSet = db.query( - "MATCH {Class: Profiles, as: profile, where: (Name='Santo' AND Surname='OrientDB')}-HasFriend-{Class: Profiles, as: friend}<-HasProfile-{class: Customers, as: customer}\n" + "MATCH {Class: Profiles, as: profile, where: (Name='Santo' AND" + + " Surname='OrientDB')}-HasFriend-{Class: Profiles, as:" + + " friend}<-HasProfile-{class: Customers, as: customer}\n" + "RETURN $pathelements"); Assert.assertEquals(resultSet.stream().count(), 15); @@ -58,7 +61,10 @@ public void test_Friendship_Example_3() throws Exception { OResultSet resultSet = db.query( - "MATCH {Class: Profiles, as: profile, where: (Name='Santo' AND Surname='OrientDB')}-HasFriend-{Class: Profiles, as: friend}<-HasProfile-{class: Customers, as: customer}-IsFromCountry->{Class: Countries, as: country}\n" + "MATCH {Class: Profiles, as: profile, where: (Name='Santo' AND" + + " Surname='OrientDB')}-HasFriend-{Class: Profiles, as:" + + " friend}<-HasProfile-{class: Customers, as: customer}-IsFromCountry->{Class:" + + " Countries, as: country}\n" + "RETURN $pathelements"); Assert.assertEquals(resultSet.stream().count(), 20); @@ -71,7 +77,10 @@ public void test_Friendship_Example_4() throws Exception { OResultSet resultSet = db.query( - "MATCH {Class: Profiles, as: profile, where: (Name='Santo' AND Surname='OrientDB')}-HasFriend-{Class: Profiles, as: friend}<-HasProfile-{class: Customers, as: customer}<-HasCustomer-{Class: Orders, as: order} \n" + "MATCH {Class: Profiles, as: profile, where: (Name='Santo' AND" + + " Surname='OrientDB')}-HasFriend-{Class: Profiles, as:" + + " friend}<-HasProfile-{class: Customers, as: customer}<-HasCustomer-{Class:" + + " Orders, as: order} \n" + "RETURN $pathelements"); Assert.assertEquals(resultSet.stream().count(), 40); @@ -92,7 +101,9 @@ public void test_Friendship_Example_5() throws Exception { + "FROM (\n" + " SELECT expand(customer) \n" + " FROM (\n" - + " MATCH {Class: Profiles, as: profile, where: (Name='Santo' AND Surname='OrientDB')}-HasFriend-{Class: Profiles, as: friend}<-HasProfile-{class: Customers, as: customer} \n" + + " MATCH {Class: Profiles, as: profile, where: (Name='Santo' AND" + + " Surname='OrientDB')}-HasFriend-{Class: Profiles, as:" + + " friend}<-HasProfile-{class: Customers, as: customer} \n" + " RETURN customer\n" + " )\n" + ") \n" @@ -123,7 +134,9 @@ public void test_Friendship_Example_6() throws Exception { + "FROM (\n" + " SELECT expand(customer) \n" + " FROM (\n" - + " MATCH {Class: Profiles, as: profile, where: (Name='Santo' AND Surname='OrientDB')}-HasFriend-{Class: Profiles, as: friend}<-HasProfile-{class: Customers, as: customer} \n" + + " MATCH {Class: Profiles, as: profile, where: (Name='Santo' AND" + + " Surname='OrientDB')}-HasFriend-{Class: Profiles, as:" + + " friend}<-HasProfile-{class: Customers, as: customer} \n" + " RETURN customer\n" + " )\n" + ") \n" @@ -153,7 +166,9 @@ public void test_Friendship_Example_7() throws Exception { + "FROM (\n" + " SELECT expand(customerFriend) \n" + " FROM (\n" - + " MATCH {Class:Customers, as: customer, where:(OrderedId=1)}-HasProfile-{Class:Profiles, as: profile}-HasFriend-{Class:Profiles, as: customerFriend} RETURN customerFriend\n" + + " MATCH {Class:Customers, as: customer," + + " where:(OrderedId=1)}-HasProfile-{Class:Profiles, as:" + + " profile}-HasFriend-{Class:Profiles, as: customerFriend} RETURN customerFriend\n" + " )\n" + ") \n" + "WHERE in('HasProfile').size()=0\n" diff --git a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationLocationsIT.java b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationLocationsIT.java index 930ff27bf9b..76af7cdb6ac 100755 --- a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationLocationsIT.java +++ b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationLocationsIT.java @@ -20,7 +20,9 @@ public void test_Locations_Example_1() throws Exception { OResultSet resultSet = db.query( - "MATCH {Class: Profiles, as: profile, where: (Name='Santo' AND Surname='OrientDB')}<-HasProfile-{Class: Customers, as: customer}-HasVisited->{class: Locations, as: location} \n" + "MATCH {Class: Profiles, as: profile, where: (Name='Santo' AND" + + " Surname='OrientDB')}<-HasProfile-{Class: Customers, as:" + + " customer}-HasVisited->{class: Locations, as: location} \n" + "RETURN $pathelements"); final List results = resultSet.stream().collect(Collectors.toList()); @@ -37,7 +39,8 @@ public void test_Locations_Example_4() throws Exception { OResultSet resultSet = db.query( - "MATCH {Class: Locations, as: location}<-HasVisited-{class: Customers, as: customer, where: (OrderedId=2)}\n" + "MATCH {Class: Locations, as: location}<-HasVisited-{class: Customers, as: customer," + + " where: (OrderedId=2)}\n" + "RETURN $pathelements"); final List results = resultSet.stream().collect(Collectors.toList()); @@ -52,7 +55,10 @@ public void test_Locations_Example_5() throws Exception { OResultSet resultSet = db.query( - "MATCH {Class: Profiles, as: profile, where: (Name='Santo' and Surname='OrientDB')}-HasFriend->{Class: Profiles, as: friend}<-HasProfile-{Class: Customers, as: customer}-HasVisited->{Class: Locations, as: location} \n" + "MATCH {Class: Profiles, as: profile, where: (Name='Santo' and" + + " Surname='OrientDB')}-HasFriend->{Class: Profiles, as:" + + " friend}<-HasProfile-{Class: Customers, as: customer}-HasVisited->{Class:" + + " Locations, as: location} \n" + "RETURN $pathelements"); final List results = resultSet.stream().collect(Collectors.toList()); diff --git a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationOrdersIT.java b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationOrdersIT.java index 641235e0e8f..3f6fe1e37a8 100755 --- a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationOrdersIT.java +++ b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationOrdersIT.java @@ -78,7 +78,8 @@ public void test_Orders_Example_4() throws Exception { + " customer.OrderedId as customerOrderedId, \n" + " SUM(order.Amount) as totalAmount \n" + "FROM (\n" - + " MATCH {Class: Customers, as: customer}<-HasCustomer-{class: Orders, as: order} \n" + + " MATCH {Class: Customers, as: customer}<-HasCustomer-{class: Orders, as: order}" + + " \n" + " RETURN customer, order\n" + ") \n" + "GROUP BY customerOrderedId \n" diff --git a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationPolymorphismIT.java b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationPolymorphismIT.java index 88b688f4a1e..55b6a8e0ffd 100755 --- a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationPolymorphismIT.java +++ b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationPolymorphismIT.java @@ -17,7 +17,8 @@ public void test_Polymorphism_Example_1() throws Exception { OResultSet resultSet = db.query( - "MATCH {class: Customers, as: customer, where: (OrderedId=1)}--{Class: Locations, as: location} RETURN $pathelements"); + "MATCH {class: Customers, as: customer, where: (OrderedId=1)}--{Class: Locations, as:" + + " location} RETURN $pathelements"); assertThat(resultSet).hasSize(16); diff --git a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationProfileIT.java b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationProfileIT.java index 62a039846f0..0fd0adc6346 100755 --- a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationProfileIT.java +++ b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationProfileIT.java @@ -44,9 +44,8 @@ public void test_Profile_Example_2() throws Exception { OResultSet resultSet = db.query( - "SELECT @rid as Profile_RID, Name, Surname, (both('HasFriend').size()) AS FriendsNumber " - + "FROM `Profiles` " - + "ORDER BY FriendsNumber DESC LIMIT 3"); + "SELECT @rid as Profile_RID, Name, Surname, (both('HasFriend').size()) AS" + + " FriendsNumber FROM `Profiles` ORDER BY FriendsNumber DESC LIMIT 3"); final List results = resultSet.stream().collect(Collectors.toList()); assertThat(results).hasSize(3); diff --git a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationRecommendationsIT.java b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationRecommendationsIT.java index 8202f546ad4..19f90620456 100755 --- a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationRecommendationsIT.java +++ b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationRecommendationsIT.java @@ -21,8 +21,10 @@ public void test_Recommendations_Example_1() throws Exception { OResultSet resultSet = db.query( "MATCH \n" - + " {class: Profiles, as: profile, where: (Name = 'Isabella' AND Surname='Gomez')}-HasFriend-{as: friend},\n" - + " {as: friend}-HasFriend-{as: friendOfFriend, where: ($matched.profile not in $currentMatch.both('HasFriend') and $matched.profile != $currentMatch)} \n" + + " {class: Profiles, as: profile, where: (Name = 'Isabella' AND" + + " Surname='Gomez')}-HasFriend-{as: friend},\n" + + " {as: friend}-HasFriend-{as: friendOfFriend, where: ($matched.profile not in" + + " $currentMatch.both('HasFriend') and $matched.profile != $currentMatch)} \n" + "RETURN DISTINCT friendOfFriend.Name"); final List results = resultSet.stream().collect(Collectors.toList()); @@ -38,7 +40,8 @@ public void test_Recommendations_Example_2() throws Exception { OResultSet resultSet = db.query( "MATCH \n" - + " {Class: Customers, as: customer, where: (OrderedId=1)}-HasProfile->{class: Profiles, as: profile},\n" + + " {Class: Customers, as: customer, where: (OrderedId=1)}-HasProfile->{class:" + + " Profiles, as: profile},\n" + " {as: profile}-HasFriend->{class: Profiles, as: friend},\n" + " {as: friend}<-HasProfile-{Class: Customers, as: customerFriend},\n" + " {as: customerFriend}-HasStayed->{Class: Hotels, as: hotel},\n" @@ -59,12 +62,14 @@ public void test_Recommendations_Example_2_bis() throws Exception { OResultSet resultSet = db.query( "MATCH\n" - + " {Class: Customers, as: customer, where: (OrderedId=1)}-HasProfile->{class: Profiles, as: profile},\n" + + " {Class: Customers, as: customer, where: (OrderedId=1)}-HasProfile->{class:" + + " Profiles, as: profile},\n" + " {as: profile}-HasFriend->{class: Profiles, as: friend},\n" + " {as: friend}<-HasProfile-{Class: Customers, as: customerFriend},\n" + " {as: customerFriend}-HasStayed->{Class: Hotels, as: hotel},\n" + " {as: customerFriend}-MadeReview->{Class: Reviews, as: review},\n" - + " {as: hotel}.outE('HasReview'){as: ReviewStars, where: (Stars>3)}.inV(){as: review}\n" + + " {as: hotel}.outE('HasReview'){as: ReviewStars, where: (Stars>3)}.inV(){as:" + + " review}\n" + "RETURN $pathelements"); final List results = resultSet.stream().collect(Collectors.toList()); diff --git a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationReviewsIT.java b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationReviewsIT.java index 402b5d6a607..b58e829cf1b 100755 --- a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationReviewsIT.java +++ b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationReviewsIT.java @@ -58,7 +58,8 @@ public void test_Reviews_Example_3() throws Exception { OResultSet resultSet = db.query( - "MATCH {class: Services, as: s}-HasReview->{class: Reviews, as: r}<-MadeReview-{class: Customers, as: c} \n" + "MATCH {class: Services, as: s}-HasReview->{class: Reviews, as: r}<-MadeReview-{class:" + + " Customers, as: c} \n" + "RETURN $pathelements"); final List results = resultSet.stream().collect(Collectors.toList()); diff --git a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationServicesIT.java b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationServicesIT.java index 56cf450bb77..cab3699b7f5 100755 --- a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationServicesIT.java +++ b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbFromDocumentationServicesIT.java @@ -20,7 +20,8 @@ public void test_Services_Example_1() throws Exception { OResultSet resultSet = db.query( - "MATCH {class: Customers, as: customer, where: (OrderedId=1)}--{Class: Services, as: service}\n" + "MATCH {class: Customers, as: customer, where: (OrderedId=1)}--{Class: Services, as:" + + " service}\n" + "RETURN $pathelements"); final List results = resultSet.stream().collect(Collectors.toList()); diff --git a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbGroupByTestIT.java b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbGroupByTestIT.java index 7df4a6a58cf..68f0fa1bedf 100755 --- a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbGroupByTestIT.java +++ b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbGroupByTestIT.java @@ -38,7 +38,8 @@ public void testGroupBy3() throws Exception { OResultSet resultSet = db.query( - "SELECT count(*), OrderDate.format('yyyy') FROM Orders GROUP BY OrderDate.format('yyyy')"); + "SELECT count(*), OrderDate.format('yyyy') FROM Orders GROUP BY" + + " OrderDate.format('yyyy')"); assertThat(resultSet).hasSize(7); resultSet.close(); @@ -50,7 +51,8 @@ public void testGroupBy4() throws Exception { OResultSet resultSet = db.query( - "SELECT count(*), OrderDate.format('yyyy') as year FROM Orders GROUP BY OrderDate.format('yyyy')"); + "SELECT count(*), OrderDate.format('yyyy') as year FROM Orders GROUP BY" + + " OrderDate.format('yyyy')"); assertThat(resultSet).hasSize(7); resultSet.close(); diff --git a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbMetadataConsistencyIT.java b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbMetadataConsistencyIT.java index 27ed799511b..ace48fc31a0 100755 --- a/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbMetadataConsistencyIT.java +++ b/distribution/src/test/java/com/orientechnologies/distribution/integration/demodb/ODemoDbMetadataConsistencyIT.java @@ -190,21 +190,24 @@ public void testDataModel() throws Exception { // all customers have a country OResultSet resultSet = db.query( - "MATCH {class: Customers, as: customer}-IsFromCountry->{class: Countries, as: country} RETURN customer"); + "MATCH {class: Customers, as: customer}-IsFromCountry->{class: Countries, as: country}" + + " RETURN customer"); assertThat(resultSet).hasSize(customersCount); resultSet.close(); // all customers have a profile resultSet = db.query( - "MATCH {class: Customers, as: customer}-HasProfile->{class: Profiles, as: profile} RETURN customer"); + "MATCH {class: Customers, as: customer}-HasProfile->{class: Profiles, as: profile}" + + " RETURN customer"); assertThat(resultSet).hasSize(customersCount); resultSet.close(); // all customers have at least 1 order resultSet = db.query( - "MATCH {class: Orders, as: order}-HasCustomer->{class: Customers, as:customer} RETURN order"); + "MATCH {class: Orders, as: order}-HasCustomer->{class: Customers, as:customer} RETURN" + + " order"); assertThat(resultSet.stream().count()).isGreaterThan(customersCount); resultSet.close(); } @@ -214,9 +217,12 @@ public void testMatchWithConditionInBackTraversal() throws Exception { OResultSet resultSet = db.query( "MATCH \n" - + "{class:Profiles, as:profileA} <-HasProfile- {as:customerA} -MadeReview-> {as:reviewA} <-HasReview- {as:restaurant},\n" - + "{as:profileB, where:($matched.profileA != $currentMatch)} <-HasProfile- {as:customerB} -MadeReview-> {as:reviewB} <-HasReview- {as:restaurant}\n" - + "return profileA.Id as idA, profileA.Name, profileA.Surname, profileB.Id as idA, profileB.Name, profileB.Surname\n" + + "{class:Profiles, as:profileA} <-HasProfile- {as:customerA} -MadeReview->" + + " {as:reviewA} <-HasReview- {as:restaurant},\n" + + "{as:profileB, where:($matched.profileA != $currentMatch)} <-HasProfile-" + + " {as:customerB} -MadeReview-> {as:reviewB} <-HasReview- {as:restaurant}\n" + + "return profileA.Id as idA, profileA.Name, profileA.Surname, profileB.Id as idA," + + " profileB.Name, profileB.Surname\n" + "limit 10\n"); int size = 0; diff --git a/etl/pom.xml b/etl/pom.xml index e528d2dd8ec..614ffc1325b 100755 --- a/etl/pom.xml +++ b/etl/pom.xml @@ -33,6 +33,8 @@ UTF-8 + + 2023-01-01T00:00:00Z diff --git a/etl/src/main/java/com/orientechnologies/orient/etl/OETLAbstractComponent.java b/etl/src/main/java/com/orientechnologies/orient/etl/OETLAbstractComponent.java index 8ca140d5e9c..896725f4798 100755 --- a/etl/src/main/java/com/orientechnologies/orient/etl/OETLAbstractComponent.java +++ b/etl/src/main/java/com/orientechnologies/orient/etl/OETLAbstractComponent.java @@ -77,9 +77,12 @@ public void setProcessor(OETLProcessor processor) { } protected String getCommonConfigurationParameters() { - return "{log:{optional:true,description:'Can be any of [NONE, ERROR, INFO, DEBUG]. Default is INFO'}}," - + "{if:{optional:true,description:'Conditional expression. If true, the block is executed, otherwise is skipped'}}," - + "{output:{optional:true,description:'Variable name to store the transformer output. If null, the output will be passed to the pipeline as input for the next component.'}}"; + return "{log:{optional:true,description:'Can be any of [NONE, ERROR, INFO, DEBUG]. Default is" + + " INFO'}},{if:{optional:true,description:'Conditional expression. If true, the" + + " block is executed, otherwise is" + + " skipped'}},{output:{optional:true,description:'Variable name to store the" + + " transformer output. If null, the output will be passed to the pipeline as input" + + " for the next component.'}}"; } @Override diff --git a/etl/src/main/java/com/orientechnologies/orient/etl/OETLComponent.java b/etl/src/main/java/com/orientechnologies/orient/etl/OETLComponent.java index aae1762338c..e15bf851371 100644 --- a/etl/src/main/java/com/orientechnologies/orient/etl/OETLComponent.java +++ b/etl/src/main/java/com/orientechnologies/orient/etl/OETLComponent.java @@ -26,7 +26,9 @@ /** ETL basic component. Each ETL component must implement this interface. */ public interface OETLComponent { - /** @return */ + /** + * @return + */ ODocument getConfiguration(); /** diff --git a/etl/src/main/java/com/orientechnologies/orient/etl/OETLProcessor.java b/etl/src/main/java/com/orientechnologies/orient/etl/OETLProcessor.java index 5d59bcb5c9a..1e9533e32f6 100755 --- a/etl/src/main/java/com/orientechnologies/orient/etl/OETLProcessor.java +++ b/etl/src/main/java/com/orientechnologies/orient/etl/OETLProcessor.java @@ -302,7 +302,8 @@ protected void dumpProgress() { .getMessageHandler() .info( this, - "+ extracted %,d %s (%,d %s/sec) - %,d %s -> loaded %,d %s (%,d %s/sec) Total time: %s [%d warnings, %d errors]", + "+ extracted %,d %s (%,d %s/sec) - %,d %s -> loaded %,d %s (%,d %s/sec) Total time:" + + " %s [%d warnings, %d errors]", extractorProgress, extractorUnit, extractorItemsSec, @@ -324,7 +325,8 @@ protected void dumpProgress() { .getMessageHandler() .info( this, - "+ %3.2f%% -> extracted %,d/%,d %s (%,d %s/sec) - %,d %s -> loaded %,d %s (%,d %s/sec) Total time: %s [%d warnings, %d errors]", + "+ %3.2f%% -> extracted %,d/%,d %s (%,d %s/sec) - %,d %s -> loaded %,d %s (%,d" + + " %s/sec) Total time: %s [%d warnings, %d errors]", extractorPercentage, extractorProgress, extractorTotal, diff --git a/etl/src/main/java/com/orientechnologies/orient/etl/block/OETLCodeBlock.java b/etl/src/main/java/com/orientechnologies/orient/etl/block/OETLCodeBlock.java index e03c555974b..c554401f9c4 100644 --- a/etl/src/main/java/com/orientechnologies/orient/etl/block/OETLCodeBlock.java +++ b/etl/src/main/java/com/orientechnologies/orient/etl/block/OETLCodeBlock.java @@ -36,8 +36,8 @@ public class OETLCodeBlock extends OETLAbstractBlock { public ODocument getConfiguration() { return new ODocument() .fromJSON( - "{parameters:[{language:{optional:true,description:'Code language, default is Javascript'}}," - + "{code:{optional:false,description:'Code to execute'}}]," + "{parameters:[{language:{optional:true,description:'Code language, default is" + + " Javascript'}},{code:{optional:false,description:'Code to execute'}}]," + "input:['Object'],output:'Object'}"); } diff --git a/etl/src/main/java/com/orientechnologies/orient/etl/block/OETLConsoleBlock.java b/etl/src/main/java/com/orientechnologies/orient/etl/block/OETLConsoleBlock.java index 1433f30dff7..4f97b54299e 100644 --- a/etl/src/main/java/com/orientechnologies/orient/etl/block/OETLConsoleBlock.java +++ b/etl/src/main/java/com/orientechnologies/orient/etl/block/OETLConsoleBlock.java @@ -36,9 +36,9 @@ public ODocument getConfiguration() { .fromJSON( "{parameters:[" + getCommonConfigurationParameters() - + "{file:{optional:true,description:'Input filename with commands.sh to execute'}}" - + "{commands.sh:{optional:true,description:'Commands to execute in sequence as an array of strings'}}" - + "]}"); + + "{file:{optional:true,description:'Input filename with commands.sh to" + + " execute'}}{commands.sh:{optional:true,description:'Commands to execute in" + + " sequence as an array of strings'}}]}"); } @Override diff --git a/etl/src/main/java/com/orientechnologies/orient/etl/extractor/OETLCSVExtractor.java b/etl/src/main/java/com/orientechnologies/orient/etl/extractor/OETLCSVExtractor.java index be437e24c08..9f8760c50d3 100644 --- a/etl/src/main/java/com/orientechnologies/orient/etl/extractor/OETLCSVExtractor.java +++ b/etl/src/main/java/com/orientechnologies/orient/etl/extractor/OETLCSVExtractor.java @@ -61,19 +61,25 @@ public ODocument getConfiguration() { .fromJSON( "{parameters:[" + getCommonConfigurationParameters() - + ",{separator:{optional:true,description:'Column separator'}}," - + "{columnsOnFirstLine:{optional:true,description:'Columns are described in the first line'}}," - + "{columns:{optional:true,description:'Columns array containing names, and optionally type after : (e.g.: name:String, age:int'}}," - + "{nullValue:{optional:true,description:'Value to consider as NULL_STRING. Default is NULL'}}," - + "{dateFormat:{optional:true,description:'Date format used to parde dates. Default is yyyy-MM-dd'}}," - + "{dateTimeFormat:{optional:true,description:'DateTime format used to parde dates. Default is yyyy-mm-dd HH:MM'}}," - + "{quote:{optional:true,description:'String character delimiter. Use \"\" to do not use any delimitator'}}," - + "{ignoreEmptyLines:{optional:true,description:'Ignore empty lines',type:'boolean'}}," - + "{ignoreMissingColumns:{optional:true,description:'Ignore empty columns',type:'boolean'}}," - + "{skipFrom:{optional:true,description:'Line number where start to skip',type:'int'}}," - + "{skipTo:{optional:true,description:'Line number where skip ends',type:'int'}}," - + "{predefinedFormat:{optional:true,description:'Name of standard csv format (from Apache commons-csv): Default, Excel, MySQL, RFC4180, TDF',type:'String'}}" - + "],input:['String'],output:'ODocument'}"); + + ",{separator:{optional:true,description:'Column" + + " separator'}},{columnsOnFirstLine:{optional:true,description:'Columns are" + + " described in the first line'}},{columns:{optional:true,description:'Columns" + + " array containing names, and optionally type after : (e.g.: name:String," + + " age:int'}},{nullValue:{optional:true,description:'Value to consider as" + + " NULL_STRING. Default is NULL'}},{dateFormat:{optional:true,description:'Date" + + " format used to parde dates. Default is" + + " yyyy-MM-dd'}},{dateTimeFormat:{optional:true,description:'DateTime format used" + + " to parde dates. Default is yyyy-mm-dd" + + " HH:MM'}},{quote:{optional:true,description:'String character delimiter. Use" + + " \"\" to do not use any" + + " delimitator'}},{ignoreEmptyLines:{optional:true,description:'Ignore empty" + + " lines',type:'boolean'}},{ignoreMissingColumns:{optional:true,description:'Ignore" + + " empty columns',type:'boolean'}},{skipFrom:{optional:true,description:'Line" + + " number where start to" + + " skip',type:'int'}},{skipTo:{optional:true,description:'Line number where skip" + + " ends',type:'int'}},{predefinedFormat:{optional:true,description:'Name of" + + " standard csv format (from Apache commons-csv): Default, Excel, MySQL, RFC4180," + + " TDF',type:'String'}}],input:['String'],output:'ODocument'}"); } @Override diff --git a/etl/src/main/java/com/orientechnologies/orient/etl/extractor/OETLJDBCExtractor.java b/etl/src/main/java/com/orientechnologies/orient/etl/extractor/OETLJDBCExtractor.java index 814736f1831..e18d70268fe 100644 --- a/etl/src/main/java/com/orientechnologies/orient/etl/extractor/OETLJDBCExtractor.java +++ b/etl/src/main/java/com/orientechnologies/orient/etl/extractor/OETLJDBCExtractor.java @@ -250,14 +250,14 @@ public OETLExtractedItem next() { public ODocument getConfiguration() { return new ODocument() .fromJSON( - "{parameters:[{driver:{optional:false,description:'JDBC Driver class'}}," - + "{url:{optional:false,description:'Connection URL'}}," - + "{userName:{optional:false,description:'User name'}}," - + "{userPassword:{optional:false,description:'User password'}}," - + "{fetchSize:{optional:true,description:'JDBC stream fetch size. Default is 10000'}}," - + "{query:{optional:false,description:'Query that extract records'}}," - + "{queryCount:{optional:true,description:'Query that returns the count to have a correct progress status'}}]," - + "output:'ODocument'}"); + "{parameters:[{driver:{optional:false,description:'JDBC Driver" + + " class'}},{url:{optional:false,description:'Connection" + + " URL'}},{userName:{optional:false,description:'User" + + " name'}},{userPassword:{optional:false,description:'User" + + " password'}},{fetchSize:{optional:true,description:'JDBC stream fetch size." + + " Default is 10000'}},{query:{optional:false,description:'Query that extract" + + " records'}},{queryCount:{optional:true,description:'Query that returns the count" + + " to have a correct progress status'}}],output:'ODocument'}"); } @Override diff --git a/etl/src/main/java/com/orientechnologies/orient/etl/loader/OETLOrientDBLoader.java b/etl/src/main/java/com/orientechnologies/orient/etl/loader/OETLOrientDBLoader.java index e2eba4b5296..2ea3b0f5b10 100644 --- a/etl/src/main/java/com/orientechnologies/orient/etl/loader/OETLOrientDBLoader.java +++ b/etl/src/main/java/com/orientechnologies/orient/etl/loader/OETLOrientDBLoader.java @@ -344,20 +344,26 @@ public ODocument getConfiguration() { + "{dbPassword:{optional:true,description:'Database password, default is admin'}}," + "{dbType:{optional:true,description:'Database type, default is document',values:" + stringArray2Json(DB_TYPE.values()) - + "}}," - + "{class:{optional:true,description:'Record class name'}}," - + "{tx:{optional:true,description:'Transaction mode: true executes in transaction, false for atomic operations'}}," - + "{dbAutoCreate:{optional:true,description:'Auto create the database if not exists. Default is true'}}," - + "{dbAutoCreateProperties:{optional:true,description:'Auto create properties in schema'}}," - + "{dbAutoDropIfExists:{optional:true,description:'Auto drop the database if already exists. Default is false.'}}," - + "{batchCommit:{optional:true,description:'Auto commit every X items. This speed up creation of edges.'}}," - + "{wal:{optional:true,description:'Use the WAL (Write Ahead Log)'}}," - + "{useLightweightEdges:{optional:true,description:'Enable/Disable LightweightEdges in Graphs. Default is false'}}," - + "{standardElementConstraints:{optional:true,description:'Enable/Disable Standard Blueprints constraints on names. Default is true'}}," - + "{cluster:{optional:true,description:'Cluster name where to store the new record'}}," - + "{settings:{optional:true,description:'OrientDB settings as a map'}}," - + "{classes:{optional:true,description:'Classes used. It assure the classes exist or in case create them'}}," - + "{indexes:{optional:true,description:'Indexes used. It assure the indexes exist or in case create them'}}]," + + "}},{class:{optional:true,description:'Record class" + + " name'}},{tx:{optional:true,description:'Transaction mode: true executes in" + + " transaction, false for atomic" + + " operations'}},{dbAutoCreate:{optional:true,description:'Auto create the" + + " database if not exists. Default is" + + " true'}},{dbAutoCreateProperties:{optional:true,description:'Auto create" + + " properties in schema'}},{dbAutoDropIfExists:{optional:true,description:'Auto" + + " drop the database if already exists. Default is" + + " false.'}},{batchCommit:{optional:true,description:'Auto commit every X items." + + " This speed up creation of edges.'}},{wal:{optional:true,description:'Use the" + + " WAL (Write Ahead" + + " Log)'}},{useLightweightEdges:{optional:true,description:'Enable/Disable" + + " LightweightEdges in Graphs. Default is" + + " false'}},{standardElementConstraints:{optional:true,description:'Enable/Disable" + + " Standard Blueprints constraints on names. Default is" + + " true'}},{cluster:{optional:true,description:'Cluster name where to store the" + + " new record'}},{settings:{optional:true,description:'OrientDB settings as a" + + " map'}},{classes:{optional:true,description:'Classes used. It assure the classes" + + " exist or in case create them'}},{indexes:{optional:true,description:'Indexes" + + " used. It assure the indexes exist or in case create them'}}]," + "input:['OrientVertex','ODocument']}"); } diff --git a/etl/src/main/java/com/orientechnologies/orient/etl/source/OETLHttpSource.java b/etl/src/main/java/com/orientechnologies/orient/etl/source/OETLHttpSource.java index c3f34caf961..5e3c57900fd 100755 --- a/etl/src/main/java/com/orientechnologies/orient/etl/source/OETLHttpSource.java +++ b/etl/src/main/java/com/orientechnologies/orient/etl/source/OETLHttpSource.java @@ -43,9 +43,9 @@ public class OETLHttpSource extends OETLAbstractSource { public ODocument getConfiguration() { return new ODocument() .fromJSON( - "{parameters:[{url:{optional:false,description:'HTTP URL to fetch'}}," - + "{httpMethod:{optional:true,description:'HTTP method to use between GET (default), POST, PUT, DELETE, HEAD'}}]," - + "output:'String'}"); + "{parameters:[{url:{optional:false,description:'HTTP URL to" + + " fetch'}},{httpMethod:{optional:true,description:'HTTP method to use between GET" + + " (default), POST, PUT, DELETE, HEAD'}}],output:'String'}"); } @Override diff --git a/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLEdgeTransformer.java b/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLEdgeTransformer.java index 535315f3e6f..f932f8367f4 100644 --- a/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLEdgeTransformer.java +++ b/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLEdgeTransformer.java @@ -48,16 +48,20 @@ public ODocument getConfiguration() { .fromJSON( "{parameters:[" + getCommonConfigurationParameters() - + "," - + "{joinValue:{optional:true,description:'value to use for join'}}," - + "{joinFieldName:{optional:true,description:'field name containing the value to join'}}," - + "{lookup:{optional:false,description:'. or Query to execute'}}," - + "{direction:{optional:true,description:'Direction between \'in\' and \'out\'. Default is \'out\''}}," - + "{class:{optional:true,description:'Edge class name. Default is \'E\''}}," - + "{targetVertexFields:{optional:true,description:'Map of fields to set in target vertex. Use ${$input.} to get input field values'}}," - + "{edgeFields:{optional:true,description:'Map of fields to set in edge. Use ${$input.} to get input field values'}}," - + "{skipDuplicates:{optional:true,description:'Duplicated edges (with a composite index built on both out and in properties) are skipped', default:false}}," - + "{unresolvedLinkAction:{optional:true,description:'action when the target vertex is not found',values:" + + ",{joinValue:{optional:true,description:'value to use for" + + " join'}},{joinFieldName:{optional:true,description:'field name containing the" + + " value to join'}},{lookup:{optional:false,description:'. or" + + " Query to execute'}},{direction:{optional:true,description:'Direction between" + + " \'in\' and \'out\'. Default is" + + " \'out\''}},{class:{optional:true,description:'Edge class name. Default is" + + " \'E\''}},{targetVertexFields:{optional:true,description:'Map of fields to set" + + " in target vertex. Use ${$input.} to get input field" + + " values'}},{edgeFields:{optional:true,description:'Map of fields to set in edge." + + " Use ${$input.} to get input field" + + " values'}},{skipDuplicates:{optional:true,description:'Duplicated edges (with a" + + " composite index built on both out and in properties) are skipped'," + + " default:false}},{unresolvedLinkAction:{optional:true,description:'action when" + + " the target vertex is not found',values:" + stringArray2Json(ACTION.values()) + "}}]," + "input:['ODocument','OVertex'],output:'OVertex'}"); @@ -164,7 +168,8 @@ private List createEdge( result = linkedV.getIdentity(); } else { throw new OConfigurationException( - "Cannot create linked document because target class is unknown. Use 'lookup' field"); + "Cannot create linked document because target class is unknown. Use 'lookup'" + + " field"); } } break; diff --git a/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLFieldTransformer.java b/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLFieldTransformer.java index 791b97fb71e..df041daadda 100644 --- a/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLFieldTransformer.java +++ b/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLFieldTransformer.java @@ -42,14 +42,14 @@ public ODocument getConfiguration() { .fromJSON( "{parameters:[" + getCommonConfigurationParameters() - + "," - + "{fieldName:{optional:true,description:'field name to apply the result'}}," - + "{fieldNames:{optional:true,description:'field names to apply the result'}}," - + "{expression:{optional:true,description:'expression to evaluate. Mandatory with operation=set (default)'}}" - + "{value:{optional:true,description:'value to set'}}" - + "{operation:{optional:false,description:'operation to execute against the field: set, remove. Default is set'}}" - + "{save:{optional:true,description:'save the vertex/edge/document right after the setting of the field'}}" - + "]," + + ",{fieldName:{optional:true,description:'field name to apply the" + + " result'}},{fieldNames:{optional:true,description:'field names to apply the" + + " result'}},{expression:{optional:true,description:'expression to evaluate." + + " Mandatory with operation=set" + + " (default)'}}{value:{optional:true,description:'value to" + + " set'}}{operation:{optional:false,description:'operation to execute against the" + + " field: set, remove. Default is set'}}{save:{optional:true,description:'save the" + + " vertex/edge/document right after the setting of the field'}}]," + "input:['ODocument'],output:'ODocument'}"); } diff --git a/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLFlowTransformer.java b/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLFlowTransformer.java index 3b613967f54..dff78e9a70a 100644 --- a/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLFlowTransformer.java +++ b/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLFlowTransformer.java @@ -33,9 +33,8 @@ public ODocument getConfiguration() { .fromJSON( "{parameters:[" + getCommonConfigurationParameters() - + "," - + "{operation:{optional:false,description:'Flow operation between: skip and halt'}}]," - + "input:['Object'],output:'Object'}"); + + ",{operation:{optional:false,description:'Flow operation between: skip and" + + " halt'}}],input:['Object'],output:'Object'}"); } @Override diff --git a/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLLinkTransformer.java b/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLLinkTransformer.java index 7e21b004aab..418d48d2c20 100644 --- a/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLLinkTransformer.java +++ b/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLLinkTransformer.java @@ -46,13 +46,14 @@ public ODocument getConfiguration() { .fromJSON( "{parameters:[" + getCommonConfigurationParameters() - + "," - + "{joinFieldName:{optional:true,description:'field name containing the value to join'}}," - + "{joinValue:{optional:true,description:'value to use in lookup query'}}," - + "{linkFieldName:{optional:false,description:'field name containing the link to set'}}," - + "{linkFieldType:{optional:true,description:'field type containing the link to set. Use LINK for single link and LINKSET or LINKLIST for many'}}," - + "{lookup:{optional:false,description:'. or Query to execute'}}," - + "{unresolvedLinkAction:{optional:true,description:'action when a unresolved link is found',values:" + + ",{joinFieldName:{optional:true,description:'field name containing the value to" + + " join'}},{joinValue:{optional:true,description:'value to use in lookup" + + " query'}},{linkFieldName:{optional:false,description:'field name containing the" + + " link to set'}},{linkFieldType:{optional:true,description:'field type containing" + + " the link to set. Use LINK for single link and LINKSET or LINKLIST for" + + " many'}},{lookup:{optional:false,description:'. or Query to" + + " execute'}},{unresolvedLinkAction:{optional:true,description:'action when a" + + " unresolved link is found',values:" + stringArray2Json(ACTION.values()) + "}}]," + "input:['ODocument'],output:'ODocument'}"); @@ -139,7 +140,8 @@ public Object executeTransform(ODatabaseDocument db, final Object input) { result = linkedDoc; } else throw new OConfigurationException( - "Cannot create linked document because target class is unknown. Use 'lookup' field"); + "Cannot create linked document because target class is unknown. Use 'lookup'" + + " field"); break; case ERROR: processor.getStats().incrementErrors(); diff --git a/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLLoadTransformer.java b/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLLoadTransformer.java index 05d88452f36..2626976fe42 100644 --- a/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLLoadTransformer.java +++ b/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLLoadTransformer.java @@ -33,10 +33,10 @@ public ODocument getConfiguration() { .fromJSON( "{parameters:[" + getCommonConfigurationParameters() - + "," - + "{joinFieldName:{optional:false,description:'field name containing the value to join'}}," - + "{lookup:{optional:false,description:'. or Query to execute'}}," - + "{unresolvedLinkAction:{optional:true,description:'action when a unresolved link is found',values:" + + ",{joinFieldName:{optional:false,description:'field name containing the value to" + + " join'}},{lookup:{optional:false,description:'. or Query to" + + " execute'}},{unresolvedLinkAction:{optional:true,description:'action when a" + + " unresolved link is found',values:" + stringArray2Json(ACTION.values()) + "}}]," + "input:['ODocument'],output:'ODocument'}"); diff --git a/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLMergeTransformer.java b/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLMergeTransformer.java index 9baab48a407..47cae2cac42 100644 --- a/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLMergeTransformer.java +++ b/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLMergeTransformer.java @@ -34,10 +34,10 @@ public ODocument getConfiguration() { .fromJSON( "{parameters:[" + getCommonConfigurationParameters() - + "," - + "{joinFieldName:{optional:false,description:'field name containing the value to join'}}," - + "{lookup:{optional:false,description:'. or Query to execute'}}," - + "{unresolvedLinkAction:{optional:true,description:'action when a unresolved link is found',values:" + + ",{joinFieldName:{optional:false,description:'field name containing the value to" + + " join'}},{lookup:{optional:false,description:'. or Query to" + + " execute'}},{unresolvedLinkAction:{optional:true,description:'action when a" + + " unresolved link is found',values:" + stringArray2Json(ACTION.values()) + "}}]," + "input:['ODocument'],output:'ODocument'}"); diff --git a/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLVertexTransformer.java b/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLVertexTransformer.java index 0227a6873b6..6d2889f4afb 100644 --- a/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLVertexTransformer.java +++ b/etl/src/main/java/com/orientechnologies/orient/etl/transformer/OETLVertexTransformer.java @@ -35,10 +35,9 @@ public ODocument getConfiguration() { .fromJSON( "{parameters:[" + getCommonConfigurationParameters() - + "," - + "{class:{optional:true,description:'Vertex class name to assign. Default is V '}}" - + ",skipDuplicates:{optional:true,description:'Vertices with duplicate keys are skipped', default:false}" - + "]" + + ",{class:{optional:true,description:'Vertex class name to assign. Default is V " + + " '}},skipDuplicates:{optional:true,description:'Vertices with duplicate keys are" + + " skipped', default:false}]" + ",input:['OrientVertex','ODocument'],output:'OrientVertex'}"); } diff --git a/etl/src/main/java/com/orientechnologies/orient/etl/util/OMigrationConfigManager.java b/etl/src/main/java/com/orientechnologies/orient/etl/util/OMigrationConfigManager.java index 74ed23109a1..f8e0b8000fb 100644 --- a/etl/src/main/java/com/orientechnologies/orient/etl/util/OMigrationConfigManager.java +++ b/etl/src/main/java/com/orientechnologies/orient/etl/util/OMigrationConfigManager.java @@ -35,6 +35,7 @@ public class OMigrationConfigManager { // config info private static final String configurationDirectoryName = "etl-config/"; private static final String configFileDefaultName = "migration-config.json"; // path + // ORIENTDB_HOME//teleporter-config/migration-config.json /** diff --git a/etl/src/test/java/com/orientechnologies/orient/etl/extractor/OETLCSVExtractorTest.java b/etl/src/test/java/com/orientechnologies/orient/etl/extractor/OETLCSVExtractorTest.java index 99e2dd2cdbb..3d75380fa83 100644 --- a/etl/src/test/java/com/orientechnologies/orient/etl/extractor/OETLCSVExtractorTest.java +++ b/etl/src/test/java/com/orientechnologies/orient/etl/extractor/OETLCSVExtractorTest.java @@ -24,7 +24,8 @@ public class OETLCSVExtractorTest extends OETLBaseTest { @Test public void testOneObject() { configure( - "{source: { content: { value: 'name,surname\nJay,Miner' } }, extractor : { csv: {} }, loader: { test: {} } }"); + "{source: { content: { value: 'name,surname\n" + + "Jay,Miner' } }, extractor : { csv: {} }, loader: { test: {} } }"); proc.execute(); assertEquals(1, getResult().size()); @@ -85,7 +86,8 @@ public void testSkipFromTwoToFour() { @Test public void testDateTypeAutodetection() { String cfgJson = - "{source: { content: { value: 'BirthDay\n2008-04-30' } }, extractor : { csv: {} }, loader: { test: {} } }"; + "{source: { content: { value: 'BirthDay\n" + + "2008-04-30' } }, extractor : { csv: {} }, loader: { test: {} } }"; configure(cfgJson); proc.execute(); @@ -100,7 +102,9 @@ public void testDateTypeAutodetection() { @Test public void testDateTypeAutodetectionWithCustomDateFormat() { String cfgJson = - "{source: { content: { value: 'BirthDay\n30-04-2008' } }, extractor : { csv: {dateFormat: \"dd-MM-yyyy\"} }, loader: { test: {} } }"; + "{source: { content: { value: 'BirthDay\n" + + "30-04-2008' } }, extractor : { csv: {dateFormat: \"dd-MM-yyyy\"} }, loader: { test:" + + " {} } }"; configure(cfgJson); proc.execute(); @@ -115,7 +119,8 @@ public void testDateTypeAutodetectionWithCustomDateFormat() { @Test public void testStringInDblQuotes() throws Exception { String cfgJson = - "{source: { content: { value: 'text\n\"Hello, quotes are here!\"' } }, extractor : { csv: {} }, loader: { test: {} } }"; + "{source: { content: { value: 'text\n" + + "\"Hello, quotes are here!\"' } }, extractor : { csv: {} }, loader: { test: {} } }"; configure(cfgJson); proc.execute(); @@ -129,7 +134,9 @@ public void testStringInDblQuotes() throws Exception { @Test public void testStringStartedFromDigit() throws Exception { String cfgJson = - "{source: { content: { value: 'address\n\"401 Congress Ave, Suite 2450\"' } }, extractor : { csv: {} }, loader: { test: {} } }"; + "{source: { content: { value: 'address\n" + + "\"401 Congress Ave, Suite 2450\"' } }, extractor : { csv: {} }, loader: { test: {}" + + " } }"; configure(cfgJson); proc.execute(); @@ -143,7 +150,8 @@ public void testStringStartedFromDigit() throws Exception { @Test public void testFloat() { String cfgJson = - "{source: { content: { value: 'firstNumber\n10.78'} }, extractor : { csv: {} }, loader: { test: {} } }"; + "{source: { content: { value: 'firstNumber\n" + + "10.78'} }, extractor : { csv: {} }, loader: { test: {} } }"; configure(cfgJson); proc.execute(); @@ -157,7 +165,8 @@ public void testFloat() { @Test public void testFloatWithinQuotesAndDotAsDecimalSeparator() { String cfgJson = - "{source: { content: { value: 'firstNumber\n\"10.78\"'} }, extractor : { csv: {} }, loader: { test: {} } }"; + "{source: { content: { value: 'firstNumber\n" + + "\"10.78\"'} }, extractor : { csv: {} }, loader: { test: {} } }"; configure(cfgJson); proc.execute(); @@ -171,7 +180,8 @@ public void testFloatWithinQuotesAndDotAsDecimalSeparator() { @Test public void testFloatWithinQuotesAndCommaAsDecimalSeparator() { String cfgJson = - "{source: { content: { value: 'firstNumber\n\"10,78\"'} }, extractor : { csv: {} }, loader: { test: {} } }"; + "{source: { content: { value: 'firstNumber\n" + + "\"10,78\"'} }, extractor : { csv: {} }, loader: { test: {} } }"; configure(cfgJson); proc.execute(); @@ -187,7 +197,9 @@ public void testDouble() { Double minDouble = 540282346638528870000000000000000000000.0d; String cfgJson = - "{source: { content: { value: 'secondNumber\n540282346638528870000000000000000000000.0'} }, extractor : { csv: {} }, loader: { test: {} } }"; + "{source: { content: { value: 'secondNumber\n" + + "540282346638528870000000000000000000000.0'} }, extractor : { csv: {} }, loader: {" + + " test: {} } }"; configure(cfgJson); proc.execute(); @@ -202,7 +214,9 @@ public void testDoubleWithingQuotes() { Double minDouble = 540282346638528870000000000000000000000.0d; String cfgJson = - "{source: { content: { value: 'secondNumber\n\"540282346638528870000000000000000000000.0\"'} }, extractor : { csv: {} }, loader: { test: {} } }"; + "{source: { content: { value: 'secondNumber\n" + + "\"540282346638528870000000000000000000000.0\"'} }, extractor : { csv: {} }, loader:" + + " { test: {} } }"; configure(cfgJson); proc.execute(); @@ -217,7 +231,9 @@ public void testDoubleWithingQuotesAndCommaAsDecimalSeparator() { Double minDouble = 540282346638528870000000000000000000000.0d; String cfgJson = - "{source: { content: { value: 'secondNumber\n\"540282346638528870000000000000000000000,0\"'} }, extractor : { csv: {} }, loader: { test: {} } }"; + "{source: { content: { value: 'secondNumber\n" + + "\"540282346638528870000000000000000000000,0\"'} }, extractor : { csv: {} }, loader:" + + " { test: {} } }"; configure(cfgJson); proc.execute(); @@ -230,7 +246,8 @@ public void testDoubleWithingQuotesAndCommaAsDecimalSeparator() { @Test public void testInteger() { String cfgJson = - "{source: { content: { value: 'number\n100'} }, extractor : { csv : {} }, loader : { test: {} } }"; + "{source: { content: { value: 'number\n" + + "100'} }, extractor : { csv : {} }, loader : { test: {} } }"; configure(cfgJson); proc.execute(); @@ -243,7 +260,8 @@ public void testInteger() { @Test public void testIntegerWithingQuotes() { String cfgJson = - "{source: { content: { value: 'number\n\"100\"'} }, extractor : { csv : {} }, loader : { test: {} } }"; + "{source: { content: { value: 'number\n" + + "\"100\"'} }, extractor : { csv : {} }, loader : { test: {} } }"; configure(cfgJson); proc.execute(); @@ -256,7 +274,8 @@ public void testIntegerWithingQuotes() { @Test public void testLong() { String cfgJson = - "{source: { content: { value: 'number\n3000000000'} }, extractor : { csv: {} }, loader : { test: {} } }"; + "{source: { content: { value: 'number\n" + + "3000000000'} }, extractor : { csv: {} }, loader : { test: {} } }"; configure(cfgJson); proc.execute(); @@ -269,7 +288,8 @@ public void testLong() { @Test public void testLongWithingQuotes() { String cfgJson = - "{source: { content: { value: 'number\n\"3000000000\"'} }, extractor : { csv : {} }, loader : { test: {} } }"; + "{source: { content: { value: 'number\n" + + "\"3000000000\"'} }, extractor : { csv : {} }, loader : { test: {} } }"; configure(cfgJson); proc.execute(); List res = getResult(); @@ -290,7 +310,8 @@ public void testIsFiniteFloat() { @Test public void testNullCell() { String cfgJson = - "{source: { content: { value: 'id,postId,text\n1,,Hello'} }, extractor : { csv : {} }, loader : { test: {} } }"; + "{source: { content: { value: 'id,postId,text\n" + + "1,,Hello'} }, extractor : { csv : {} }, loader : { test: {} } }"; configure(cfgJson); proc.execute(); List res = getResult(); @@ -303,7 +324,8 @@ public void testNullCell() { @Test public void testNullValueInCell() { String cfgJson = - "{source: { content: { value: 'id,postId,text\n1,NULL,Hello'} }, extractor : { csv : {} }, loader : { test: {} } }"; + "{source: { content: { value: 'id,postId,text\n" + + "1,NULL,Hello'} }, extractor : { csv : {} }, loader : { test: {} } }"; configure(cfgJson); proc.execute(); @@ -318,7 +340,8 @@ public void testNullValueInCell() { @Test public void testCustomNullValueInCell() { String cfgJson = - "{source: { content: { value: 'id,postId,text\n1,?,Hello'} }, extractor : { csv : {nullValue: \"?\"} }, loader : { test: {} } }"; + "{source: { content: { value: 'id,postId,text\n" + + "1,?,Hello'} }, extractor : { csv : {nullValue: \"?\"} }, loader : { test: {} } }"; configure(cfgJson); proc.execute(); @@ -333,7 +356,8 @@ public void testCustomNullValueInCell() { @Test public void testNullValueInCellEmptyString() { String cfgJson = - "{source: { content: { value: 'id,title,text\n1,\"\",Hello'} }, extractor : { csv: {} }, loader : { test: {} } }"; + "{source: { content: { value: 'id,title,text\n" + + "1,\"\",Hello'} }, extractor : { csv: {} }, loader : { test: {} } }"; configure(cfgJson); proc.execute(); @@ -350,7 +374,8 @@ public void testNullValueInCellEmptyString() { @Test public void testQuotedEmptyString() { String cfgJson = - "{source: { content: { value: 'id,title,text\n1,\"\",Hello'} }, extractor : { csv : {} }, loader : { test: {} } }"; + "{source: { content: { value: 'id,title,text\n" + + "1,\"\",Hello'} }, extractor : { csv : {} }, loader : { test: {} } }"; configure(cfgJson); proc.execute(); @@ -365,7 +390,8 @@ public void testQuotedEmptyString() { @Test public void testCRLFDelimiter() { String cfgJson = - "{source: { content: { value: 'id,text,num\r\n1,my test text,1'} }, extractor : { csv : {} }, loader : { test: {} } }"; + "{source: { content: { value: 'id,text,num\r\n" + + "1,my test text,1'} }, extractor : { csv : {} }, loader : { test: {} } }"; configure(cfgJson); proc.execute(); @@ -381,7 +407,9 @@ public void testCRLFDelimiter() { @Test public void testEndingLineBreak() { String cfgJson = - "{source: { content: { value: 'id,text,num\r\n1,my test text,1\r\n'} }, extractor : { csv : {} }, loader : { test: {} } }"; + "{source: { content: { value: 'id,text,num\r\n" + + "1,my test text,1\r\n" + + "'} }, extractor : { csv : {} }, loader : { test: {} } }"; configure(cfgJson); proc.execute(); @@ -396,7 +424,9 @@ public void testEndingLineBreak() { @Test public void testEndingSpaceInFieldName() { String cfgJson = - "{source: { content: { value: 'id ,text ,num \r\n1,my test text,1\r\n'} }, extractor : { csv : {} }, loader : { test: {} } }"; + "{source: { content: { value: 'id ,text ,num \r\n" + + "1,my test text,1\r\n" + + "'} }, extractor : { csv : {} }, loader : { test: {} } }"; configure(cfgJson); proc.execute(); @@ -412,7 +442,10 @@ public void testEndingSpaceInFieldName() { @Test public void testCRLFIWithinQuotes() { String cfgJson = - "{source: { content: { value: 'id ,text ,num \r\n1,\"my test\r\n text\",1\r\n'} }, extractor : { csv : {} }, loader : { test: {} } }"; + "{source: { content: { value: 'id ,text ,num \r\n" + + "1,\"my test\r\n" + + " text\",1\r\n" + + "'} }, extractor : { csv : {} }, loader : { test: {} } }"; configure(cfgJson); proc.execute(); @@ -427,7 +460,9 @@ public void testCRLFIWithinQuotes() { @Test public void testEscapingDoubleQuotes() { String cfgJson = - "{source: { content: { value: 'id ,text ,num \r\n1,my test \"\" text,1\r\n'} }, extractor : { csv : {} }, loader : { test: {} } }"; + "{source: { content: { value: 'id ,text ,num \r\n" + + "1,my test \"\" text,1\r\n" + + "'} }, extractor : { csv : {} }, loader : { test: {} } }"; configure(cfgJson); proc.execute(); @@ -442,7 +477,8 @@ public void testEscapingDoubleQuotes() { @Test public void testNegativeInteger() { String cfgJson = - "{source: { content: { value: 'id\r\n-1'} }, extractor : { csv : {} }, loader : { test: {} } }"; + "{source: { content: { value: 'id\r\n" + + "-1'} }, extractor : { csv : {} }, loader : { test: {} } }"; configure(cfgJson); proc.execute(); @@ -455,7 +491,8 @@ public void testNegativeInteger() { @Test public void testNegativeFloat() { String cfgJson = - "{source: { content: { value: 'id\r\n-1.0'} }, extractor : { csv : {} }, loader : { test: {} } }"; + "{source: { content: { value: 'id\r\n" + + "-1.0'} }, extractor : { csv : {} }, loader : { test: {} } }"; configure(cfgJson); proc.execute(); @@ -468,7 +505,9 @@ public void testNegativeFloat() { @Test public void testLinkType() { String cfgJson = - "{source: { content: { value: 'num,id\n3,#1:1'} }, extractor : { csv : {'columns':['num:INTEGER','id:LINK']} }, loader : { test: {} } }"; + "{source: { content: { value: 'num,id\n" + + "3,#1:1'} }, extractor : { csv : {'columns':['num:INTEGER','id:LINK']} }, loader : {" + + " test: {} } }"; configure(cfgJson); proc.execute(); @@ -482,7 +521,8 @@ public void testLinkType() { @Test public void testBooleanType() { String cfgJson = - "{source: { content: { value: 'fake\ntrue'} }, extractor : { csv : {} }, loader : { test: {} } }"; + "{source: { content: { value: 'fake\n" + + "true'} }, extractor : { csv : {} }, loader : { test: {} } }"; configure(cfgJson); proc.execute(); @@ -496,7 +536,10 @@ public void testBooleanType() { @Test public void testColumsDefinitions() { String cfgJson = - "{source: { content: { value: 'name,date,datetime\nfrank,2008-04-30,2015-03-30 11:00'} }, extractor : { csv : { 'columns':['name:string','date:date','datetime:datetime']} }, loader : { test: {} } }"; + "{source: { content: { value: 'name,date,datetime\n" + + "frank,2008-04-30,2015-03-30 11:00'} }, extractor : { csv : {" + + " 'columns':['name:string','date:date','datetime:datetime']} }, loader : { test: {} }" + + " }"; configure(cfgJson); proc.execute(); @@ -520,7 +563,10 @@ public void testColumsDefinitions() { public void testCsvParsingFormat() { String cfgJson = - "{source: { content: { value: 'name,date,datetime\nfrank,2008-04-30,2015-03-30 11:00'} }, extractor : { csv : { \"predefinedFormat\": \"Default\",'columns':['name:string','date:date','datetime:datetime']} }, loader : { test: {} } }"; + "{source: { content: { value: 'name,date,datetime\n" + + "frank,2008-04-30,2015-03-30 11:00'} }, extractor : { csv : { \"predefinedFormat\":" + + " \"Default\",'columns':['name:string','date:date','datetime:datetime']} }, loader :" + + " { test: {} } }"; configure(cfgJson); proc.execute(); @@ -538,7 +584,9 @@ public void testCsvParsingFormat() { @Test public void testMissingColumns() { String cfgJson = - "{source: { content: { value: 'name,value,,\nfrank,myvalue,,'} }, extractor : { csv : { \"ignoreMissingColumns\": true } }, loader : { test: {} } }"; + "{source: { content: { value: 'name,value,,\n" + + "frank,myvalue,,'} }, extractor : { csv : { \"ignoreMissingColumns\": true } }," + + " loader : { test: {} } }"; configure(cfgJson); proc.execute(); @@ -553,7 +601,9 @@ public void testMissingColumns() { @Test public void testExcelFormat() { String cfgJson = - "{source: { content: { value: 'name,value,,\nfrank,myvalue,,'} }, extractor : { csv : { \"predefinedFormat\": \"Excel\" } }, loader : { test: {} } }"; + "{source: { content: { value: 'name,value,,\n" + + "frank,myvalue,,'} }, extractor : { csv : { \"predefinedFormat\": \"Excel\" } }," + + " loader : { test: {} } }"; configure(cfgJson); proc.execute(); diff --git a/etl/src/test/java/com/orientechnologies/orient/etl/extractor/OETLJsonExtractorTest.java b/etl/src/test/java/com/orientechnologies/orient/etl/extractor/OETLJsonExtractorTest.java index 9b034093323..ba0fd682091 100755 --- a/etl/src/test/java/com/orientechnologies/orient/etl/extractor/OETLJsonExtractorTest.java +++ b/etl/src/test/java/com/orientechnologies/orient/etl/extractor/OETLJsonExtractorTest.java @@ -55,7 +55,8 @@ public void testEmptyObject() { @Test public void testOneObject() { configure( - "{source: { content: { value: { name: 'Jay', surname: 'Miner' } } }, extractor : { json: {} }, loader: { test: {} } }"); + "{source: { content: { value: { name: 'Jay', surname: 'Miner' } } }, extractor : { json: {}" + + " }, loader: { test: {} } }"); proc.execute(); assertEquals(1, getResult().size()); diff --git a/etl/src/test/java/com/orientechnologies/orient/etl/extractor/OETLXmlExtractorTest.java b/etl/src/test/java/com/orientechnologies/orient/etl/extractor/OETLXmlExtractorTest.java index 2e0e3554e98..8d99d7fd69f 100644 --- a/etl/src/test/java/com/orientechnologies/orient/etl/extractor/OETLXmlExtractorTest.java +++ b/etl/src/test/java/com/orientechnologies/orient/etl/extractor/OETLXmlExtractorTest.java @@ -38,7 +38,8 @@ public class OETLXmlExtractorTest extends OETLBaseTest { @Test public void testSimpleXml() { configure( - "{source: { file: { path: 'src/test/resources/simple.xml' } }, extractor : { xml: {} }, loader: { test: {} } }"); + "{source: { file: { path: 'src/test/resources/simple.xml' } }, extractor : { xml: {} }," + + " loader: { test: {} } }"); proc.execute(); assertEquals(1, getResult().size()); @@ -70,7 +71,9 @@ public void testSimpleXml() { @Test public void testCollectionXml() { configure( - "{source: { file: { path: 'src/test/resources/music.xml' } }, extractor : { xml: { rootNode: 'CATALOG.CD', tagsAsAttribute: ['CATALOG.CD'] } }, loader: { test: {} } }"); + "{source: { file: { path: 'src/test/resources/music.xml' } }, extractor : { xml: {" + + " rootNode: 'CATALOG.CD', tagsAsAttribute: ['CATALOG.CD'] } }, loader: { test: {} }" + + " }"); proc.execute(); assertEquals(3, getResult().size()); diff --git a/etl/src/test/java/com/orientechnologies/orient/etl/integration/ETLJobTest.java b/etl/src/test/java/com/orientechnologies/orient/etl/integration/ETLJobTest.java index 9e76c67d6c6..1b847cc685a 100644 --- a/etl/src/test/java/com/orientechnologies/orient/etl/integration/ETLJobTest.java +++ b/etl/src/test/java/com/orientechnologies/orient/etl/integration/ETLJobTest.java @@ -48,7 +48,8 @@ public void onEnd(OETLJob oetlJob) { } }); String json = - "{source: { content: { value: 'name,surname,@class\nJay,Miner,Person' } }, extractor : { csv: {} }, loader: { orientdb: {\n" + "{source: { content: { value: 'name,surname,@class\n" + + "Jay,Miner,Person' } }, extractor : { csv: {} }, loader: { orientdb: {\n" + " dbURL: 'memory:" + name.getMethodName() + "',\n" diff --git a/etl/src/test/java/com/orientechnologies/orient/etl/loader/OETLOrientDBLoaderTest.java b/etl/src/test/java/com/orientechnologies/orient/etl/loader/OETLOrientDBLoaderTest.java index 613eef4c56c..d4ca9373cec 100644 --- a/etl/src/test/java/com/orientechnologies/orient/etl/loader/OETLOrientDBLoaderTest.java +++ b/etl/src/test/java/com/orientechnologies/orient/etl/loader/OETLOrientDBLoaderTest.java @@ -37,7 +37,8 @@ public class OETLOrientDBLoaderTest extends OETLBaseTest { public void shouldFailToManageRemoteServer() throws Exception { configure( - "{source: { content: { value: 'name,surname\nJay,Miner' } }, extractor : { csv: {} }, loader: { orientdb: {\n" + "{source: { content: { value: 'name,surname\n" + + "Jay,Miner' } }, extractor : { csv: {} }, loader: { orientdb: {\n" + " dbURL: \"remote:sadserver/OETLBaseTest\",\n" + " dbUser: \"admin\",\n" + " dbPassword: \"admin\",\n" @@ -51,7 +52,8 @@ public void shouldFailToManageRemoteServer() throws Exception { + " classes: [\n" + " {name:\"Person\", extends: \"V\" },\n" + " ],\n" - + " indexes: [{class:\"V\" , fields:[\"surname:String\"], \"type\":\"NOTUNIQUE\", \"metadata\": { \"ignoreNullValues\" : \"false\"}} ] } } }"); + + " indexes: [{class:\"V\" , fields:[\"surname:String\"], \"type\":\"NOTUNIQUE\"," + + " \"metadata\": { \"ignoreNullValues\" : \"false\"}} ] } } }"); proc.execute(); } @@ -60,7 +62,8 @@ public void shouldFailToManageRemoteServer() throws Exception { public void testAddMetadataToIndex() { configure( - "{source: { content: { value: 'name,surname\nJay,Miner' } }, extractor : { csv: {} }, loader: { orientdb: {\n" + "{source: { content: { value: 'name,surname\n" + + "Jay,Miner' } }, extractor : { csv: {} }, loader: { orientdb: {\n" + " dbURL: 'memory:" + name.getMethodName() + "',\n" @@ -74,7 +77,8 @@ public void testAddMetadataToIndex() { + " classes: [\n" + " {name:\"Person\", extends: \"V\" },\n" + " ],\n" - + " indexes: [{class:\"V\" , fields:[\"surname:String\"], \"type\":\"NOTUNIQUE\", \"metadata\": { \"ignoreNullValues\" : \"false\"}} ] } } }"); + + " indexes: [{class:\"V\" , fields:[\"surname:String\"], \"type\":\"NOTUNIQUE\"," + + " \"metadata\": { \"ignoreNullValues\" : \"false\"}} ] } } }"); proc.execute(); ODatabaseDocumentInternal db = (ODatabaseDocumentInternal) proc.getLoader().getPool().acquire(); @@ -114,7 +118,9 @@ public void testCreateLuceneIndex() { + " classes: [\n" + " {name:\"Person\", extends: \"V\" },\n" + " ],\n" - + " indexes: [{class:\"Person\" , fields:[\"surname:String\"], \"type\":\"FULLTEXT\", \"algorithm\":\"LUCENE\", \"metadata\": { \"ignoreNullValues\" : \"false\"}} ] } } }"); + + " indexes: [{class:\"Person\" , fields:[\"surname:String\"]," + + " \"type\":\"FULLTEXT\", \"algorithm\":\"LUCENE\", \"metadata\": {" + + " \"ignoreNullValues\" : \"false\"}} ] } } }"); proc.execute(); @@ -141,7 +147,8 @@ public void testCreateLuceneIndex() { public void shouldSaveDocumentsOnGivenCluster() { configure( - "{source: { content: { value: 'name,surname\nJay,Miner' } }, extractor : { csv: {} }, loader: { orientdb: {\n" + "{source: { content: { value: 'name,surname\n" + + "Jay,Miner' } }, extractor : { csv: {} }, loader: { orientdb: {\n" + " dbURL: \"memory:" + name.getMethodName() + "\",\n" @@ -156,7 +163,8 @@ public void shouldSaveDocumentsOnGivenCluster() { + " classes: [\n" + " {name:\"Person\", extends: \"V\" },\n" + " ],\n" - + " indexes: [{class:\"V\" , fields:[\"surname:String\"], \"type\":\"NOTUNIQUE\", \"metadata\": { \"ignoreNullValues\" : \"false\"}} ] } } }"); + + " indexes: [{class:\"V\" , fields:[\"surname:String\"], \"type\":\"NOTUNIQUE\"," + + " \"metadata\": { \"ignoreNullValues\" : \"false\"}} ] } } }"); proc.execute(); ODatabaseDocument db = proc.getLoader().getPool().acquire(); @@ -177,7 +185,8 @@ public void shouldSaveDocumentsOnGivenCluster() { public void shouldSaveDocuments() { configure( - "{source: { content: { value: 'name,surname,@class\nJay,Miner,Person' } }, extractor : { csv: {} }, loader: { orientdb: {\n" + "{source: { content: { value: 'name,surname,@class\n" + + "Jay,Miner,Person' } }, extractor : { csv: {} }, loader: { orientdb: {\n" + " dbURL: 'memory:" + name.getMethodName() + "',\n" @@ -211,8 +220,10 @@ public void shouldSaveDocumentsWithPredefinedSchema() { // configure configure( - "{source: { content: { value: 'name,surname,married,birthday\nJay,Miner,false,1970-01-01 05:30:00' } }, " - + "extractor : { csv: {columns:['name:string','surname:string','married:boolean','birthday:datetime'], dateFormat :'yyyy-MM-dd HH:mm:ss'} }, loader: { orientdb: {\n" + "{source: { content: { value: 'name,surname,married,birthday\n" + + "Jay,Miner,false,1970-01-01 05:30:00' } }, extractor : { csv:" + + " {columns:['name:string','surname:string','married:boolean','birthday:datetime']," + + " dateFormat :'yyyy-MM-dd HH:mm:ss'} }, loader: { orientdb: {\n" + " dbURL: 'memory:" + name.getMethodName() + "', class:'Person', dbUser: \"admin\",\n" diff --git a/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLCommandTransformerTest.java b/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLCommandTransformerTest.java index 518aa0ca790..72282721aa5 100644 --- a/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLCommandTransformerTest.java +++ b/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLCommandTransformerTest.java @@ -42,7 +42,9 @@ public void shouldAllowSingleQuoteInsideFieldValue() { + " },\n" + " 'source': {\n" + " 'content': {\n" - + " 'value': \"name,surname\n Jay, Miner O'Greedy \n Jay, Miner O'Greedy \"\n" + + " 'value': \"name,surname\n" + + " Jay, Miner O'Greedy \n" + + " Jay, Miner O'Greedy \"\n" + " }\n" + " },\n" + " 'transformers': [\n" @@ -51,12 +53,11 @@ public void shouldAllowSingleQuoteInsideFieldValue() { + " 'log': 'INFO',\n" + " 'output': 'previous',\n" + " 'language': 'sql',\n" - + " 'command': \"SELECT name FROM Person WHERE surname= \"={eval('$input.surname')}\"\"\n" + + " 'command': \"SELECT name FROM Person WHERE surname=" + + " \"={eval('$input.surname')}\"\"\n" + " }\n" + " },\n" - + " {vertex: {class:'Person', skipDuplicates:false}} " - + "]," - + " 'extractor': {\n" + + " {vertex: {class:'Person', skipDuplicates:false}} ], 'extractor': {\n" + " 'csv': {}\n" + " },\n" + " 'loader': {\n" diff --git a/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLEdgeTransformerTest.java b/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLEdgeTransformerTest.java index 9b89c1bfa83..14812873205 100755 --- a/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLEdgeTransformerTest.java +++ b/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLEdgeTransformerTest.java @@ -80,9 +80,10 @@ public void createClasses(ODatabaseDocument db) { @Test public void testNotLightweightEdge() { configure( - "{source: { content: { value: 'name,surname,friend\nJay,Miner,Luca' } }, extractor : { csv: {} }," - + " transformers: [{vertex: {class:'V1'}}, {edge:{class:'Friend',joinFieldName:'friend',lookup:'V2.name'}}," - + "], loader: { orientdb: { dbURL: 'memory:" + "{source: { content: { value: 'name,surname,friend\n" + + "Jay,Miner,Luca' } }, extractor : { csv: {} }, transformers: [{vertex: {class:'V1'}}," + + " {edge:{class:'Friend',joinFieldName:'friend',lookup:'V2.name'}},], loader: {" + + " orientdb: { dbURL: 'memory:" + name.getMethodName() + "', dbType:'graph', useLightweightEdges:false } } }"); @@ -104,9 +105,10 @@ public void testNotLightweightEdge() { @Test public void testLookupMultipleValues() { configure( - "{source: { content: { value: 'name,surname,friend\nJay,Miner,Luca' } }, extractor : { csv: {} }," - + " transformers: [{vertex: {class:'V1'}}, {edge:{class:'Friend',joinFieldName:'friend',lookup:'V2.name'}}," - + "], loader: { orientdb: { dbURL: 'memory:" + "{source: { content: { value: 'name,surname,friend\n" + + "Jay,Miner,Luca' } }, extractor : { csv: {} }, transformers: [{vertex: {class:'V1'}}," + + " {edge:{class:'Friend',joinFieldName:'friend',lookup:'V2.name'}},], loader: {" + + " orientdb: { dbURL: 'memory:" + name.getMethodName() + "', dbType:'graph', useLightweightEdges:false } } }"); @@ -134,11 +136,13 @@ public void testLookupMultipleValues() { @Test public void testEdgeWithProperties() { configure( - "{source: { content: { value: 'id,name,surname,friendSince,friendId,friendName,friendSurname\n0,Jay,Miner,1996,1,Luca,Garulli' } }, extractor : { csv: {} }," - + " transformers: [ {vertex: {class:'V1'}}, " + "{source: { content: { value:" + + " 'id,name,surname,friendSince,friendId,friendName,friendSurname\n" + + "0,Jay,Miner,1996,1,Luca,Garulli' } }, extractor : { csv: {} }, transformers: [" + + " {vertex: {class:'V1'}}, " + "{edge:{unresolvedLinkAction:'CREATE',class:'Friend',joinFieldName:'friendId',lookup:'V2.fid',targetVertexFields:{name:'${input.friendName}',surname:'${input.friendSurname}'},edgeFields:{since:'${input.friendSince}'}}}," - + "{field:{fieldNames:['friendSince','friendId','friendName','friendSurname'],operation:'remove'}}" - + "], loader: { orientdb: { dbURL: 'memory:" + + "{field:{fieldNames:['friendSince','friendId','friendName','friendSurname'],operation:'remove'}}]," + + " loader: { orientdb: { dbURL: 'memory:" + name.getMethodName() + "', dbType:'graph', useLightweightEdges:false } } }"); @@ -191,9 +195,12 @@ public void testEdgeWithProperties() { @Test public void testErrorOnDuplicateVertex() { configure( - "{source: { content: { value: 'name,surname,friend\nJay,Miner,Luca\nJay,Miner,Luca' } }, extractor : { csv: {} }," - + " transformers: [{merge: {joinFieldName:'name',lookup:'V1.name'}}, {vertex: {class:'V1'}}, {edge:{class:'Friend',joinFieldName:'friend',lookup:'V2.name'}}," - + "], loader: { orientdb: { dbURL: 'memory:" + "{source: { content: { value: 'name,surname,friend\n" + + "Jay,Miner,Luca\n" + + "Jay,Miner,Luca' } }, extractor : { csv: {} }, transformers: [{merge:" + + " {joinFieldName:'name',lookup:'V1.name'}}, {vertex: {class:'V1'}}," + + " {edge:{class:'Friend',joinFieldName:'friend',lookup:'V2.name'}},], loader: {" + + " orientdb: { dbURL: 'memory:" + name.getMethodName() + "', dbType:'graph', useLightweightEdges:false } } }"); @@ -212,10 +219,12 @@ public void testErrorOnDuplicateVertex() { @Test public void testSkipDuplicateVertex() { configure( - "{source: { content: { value: 'name,surname,friend\nJay,Miner,Luca\nJay,Miner,Luca' } }, extractor : { csv: {} }," - + " transformers: [ {merge: {joinFieldName:'name',lookup:'V1.name'}}, " - + "{vertex: {class:'V1'}}, {edge:{class:'Friend',skipDuplicates:true, joinFieldName:'friend',lookup:'V2.name'}}," - + "], loader: { orientdb: { dbURL: 'memory:" + "{source: { content: { value: 'name,surname,friend\n" + + "Jay,Miner,Luca\n" + + "Jay,Miner,Luca' } }, extractor : { csv: {} }, transformers: [ {merge:" + + " {joinFieldName:'name',lookup:'V1.name'}}, {vertex: {class:'V1'}}," + + " {edge:{class:'Friend',skipDuplicates:true," + + " joinFieldName:'friend',lookup:'V2.name'}},], loader: { orientdb: { dbURL: 'memory:" + name.getMethodName() + "', dbType:'graph', useLightweightEdges:false } } }"); @@ -237,9 +246,14 @@ public void testSkipDuplicateVertex() { public void testVertexAndEdgesOnSeparatedFiles() { // IMPORT PERSON (VERTICES) configure( - "{source: { content: { value: 'id,name\n1,Luigi\n2,Luca\n3,Enrico\n4,Franco\n5,Gianni' } }, extractor : { csv: {} }," - + " transformers: [ {merge: {joinFieldName:'id',lookup:'PersonMF.id'}}, {vertex: {class:'PersonMF'}}" - + "], loader: { orientdb: { dbURL: 'plocal:./target/databases/etlEdgeTransformerTest" + "{source: { content: { value: 'id,name\n" + + "1,Luigi\n" + + "2,Luca\n" + + "3,Enrico\n" + + "4,Franco\n" + + "5,Gianni' } }, extractor : { csv: {} }, transformers: [ {merge:" + + " {joinFieldName:'id',lookup:'PersonMF.id'}}, {vertex: {class:'PersonMF'}}], loader:" + + " { orientdb: { dbURL: 'plocal:./target/databases/etlEdgeTransformerTest" + name.getMethodName() + "', dbType:'graph', classes: [{name:'PersonMF',extends:'V'}] } } }"); @@ -266,13 +280,11 @@ public void testVertexAndEdgesOnSeparatedFiles() { + "1,4,2015\n" + "2,5,2008\n" + "3,5,2015\n" - + "4,5,2015' } }, extractor : { csv: {} }," - + " transformers: [" - + "{merge: {joinFieldName:'friend_from',lookup:'PersonMF.id'}}," - + "{vertex: {class:'PersonMF'}}," - + "{edge:{class:'FriendMF',joinFieldName:'friend_to',lookup:'PersonMF.id',edgeFields:{since:'${input.since}'} }}," - + "{field: {operation:'remove', fieldNames:['friend_from','friend_to','since']}}" - + "], loader: { orientdb: { dbURL: 'plocal:./target/databases/etlEdgeTransformerTest" + + "4,5,2015' } }, extractor : { csv: {} }, transformers: [{merge:" + + " {joinFieldName:'friend_from',lookup:'PersonMF.id'}},{vertex:" + + " {class:'PersonMF'}},{edge:{class:'FriendMF',joinFieldName:'friend_to',lookup:'PersonMF.id',edgeFields:{since:'${input.since}'}" + + " }},{field: {operation:'remove', fieldNames:['friend_from','friend_to','since']}}]," + + " loader: { orientdb: { dbURL: 'plocal:./target/databases/etlEdgeTransformerTest" + name.getMethodName() + "', dbType:'graph', classes: [{name:'FriendMF',extends:'E'}] } } }"); diff --git a/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLFieldTransformerTest.java b/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLFieldTransformerTest.java index ef59976ba00..3a90cd492cb 100644 --- a/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLFieldTransformerTest.java +++ b/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLFieldTransformerTest.java @@ -37,7 +37,9 @@ public class OETLFieldTransformerTest extends OETLBaseTest { @Test public void testValue() { configure( - "{source: { content: { value: 'name,surname\nJay,Miner' } }, extractor : { csv: {} }, transformers: [{field: {fieldName:'test', value: 33}}], loader: { test: {} } }"); + "{source: { content: { value: 'name,surname\n" + + "Jay,Miner' } }, extractor : { csv: {} }, transformers: [{field: {fieldName:'test'," + + " value: 33}}], loader: { test: {} } }"); proc.execute(); assertEquals(1, getResult().size()); @@ -52,7 +54,9 @@ public void testValue() { @Test public void testExpression() { configure( - "{source: { content: { value: 'name,surname\nJay,Miner' } }, extractor : { csv: {} }, transformers: [ {field: {fieldName:'test', expression: 'surname'}}], loader: { test: {} } }"); + "{source: { content: { value: 'name,surname\n" + + "Jay,Miner' } }, extractor : { csv: {} }, transformers: [ {field: {fieldName:'test'," + + " expression: 'surname'}}], loader: { test: {} } }"); proc.execute(); assertEquals(1, getResult().size()); @@ -66,7 +70,9 @@ public void testExpression() { @Test public void testToLowerCase() { configure( - "{source: { content: { value: 'name,surname\nJay,Miner' } }, extractor : { csv: {} }, transformers: [ {field: {fieldName:'name', expression: '$input.name.toLowerCase()'}}], loader: { test: {} } }"); + "{source: { content: { value: 'name,surname\n" + + "Jay,Miner' } }, extractor : { csv: {} }, transformers: [ {field: {fieldName:'name'," + + " expression: '$input.name.toLowerCase()'}}], loader: { test: {} } }"); proc.execute(); assertEquals(1, getResult().size()); diff --git a/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLFlowTransformerTest.java b/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLFlowTransformerTest.java index 5839c9e27c0..ca2bef72020 100644 --- a/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLFlowTransformerTest.java +++ b/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLFlowTransformerTest.java @@ -36,11 +36,11 @@ public class OETLFlowTransformerTest extends OETLBaseTest { public void testSkip() { configure( - "{source: { content: { value: 'name,surname\nJay,Miner\nSkipMe,Test' } }, extractor : { csv: {} }," - + " transformers: [{vertex: {class:'V'}}, " - + "{flow:{operation:'skip',if: 'name <> \'Jay\''}}," - + "{field:{fieldName:'name', value:'3'}}" - + "], loader: { orientdb: { dbURL: 'memory:" + "{source: { content: { value: 'name,surname\n" + + "Jay,Miner\n" + + "SkipMe,Test' } }, extractor : { csv: {} }, transformers: [{vertex: {class:'V'}}," + + " {flow:{operation:'skip',if: 'name <> \'Jay\''}},{field:{fieldName:'name'," + + " value:'3'}}], loader: { orientdb: { dbURL: 'memory:" + name.getMethodName() + "', dbType:'graph' } } }"); proc.execute(); diff --git a/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLLoadTransformerTest.java b/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLLoadTransformerTest.java index 9c47d6a7ecb..35938ccdb99 100644 --- a/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLLoadTransformerTest.java +++ b/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLLoadTransformerTest.java @@ -31,7 +31,9 @@ import org.junit.Before; import org.junit.Test; -/** @author Luca Garulli */ +/** + * @author Luca Garulli + */ public class OETLLoadTransformerTest extends OETLBaseTest { @Before @@ -107,10 +109,12 @@ public void shouldLoadVertexOnDuplicatedInputSet() throws Exception { // CSV contains duplicated data configure( - "{source: { content: { value: 'num,name\n10000,FirstName\n10001,SecondName\n10000,FirstNameUpdated' } }, extractor : { csv: {} }," - + " transformers: [{load: { joinFieldName:'num', lookup:'Person.num'}}, {vertex: {class:'Person', skipDuplicates: true}}]," - + " " - + "loader: { orientdb: { dbURL: 'memory:" + "{source: { content: { value: 'num,name\n" + + "10000,FirstName\n" + + "10001,SecondName\n" + + "10000,FirstNameUpdated' } }, extractor : { csv: {} }, transformers: [{load: {" + + " joinFieldName:'num', lookup:'Person.num'}}, {vertex: {class:'Person'," + + " skipDuplicates: true}}], loader: { orientdb: { dbURL: 'memory:" + name.getMethodName() + "', dbType:'graph', useLightweightEdges:false } } }"); @@ -152,10 +156,12 @@ public void loadVerticesCreateEdges() throws Exception { configure( "{source: { content: { value: '" + csv - + "' } }, extractor : { csv: {} }," - + "transformers: [{load: { joinFieldName:'depot', lookup:'SupplyChainNode.id'}}" - + ", {edge: { class: 'HAS_ROUTE_TO', joinFieldName: '${extractedPayload.store}', lookup: 'SupplyChainNode.id', edgeFields: { 'StartDate': '${extractedPayload.StartDate}', 'EndDate': '${extractedPayload.EndDate}' }, direction: 'out', unresolvedLinkAction: 'NOTHING' } }" - + "], loader: { orientdb: { dbURL: 'memory:" + + "' } }, extractor : { csv: {} },transformers: [{load: { joinFieldName:'depot'," + + " lookup:'SupplyChainNode.id'}}, {edge: { class: 'HAS_ROUTE_TO', joinFieldName:" + + " '${extractedPayload.store}', lookup: 'SupplyChainNode.id', edgeFields: {" + + " 'StartDate': '${extractedPayload.StartDate}', 'EndDate':" + + " '${extractedPayload.EndDate}' }, direction: 'out', unresolvedLinkAction: 'NOTHING'" + + " } }], loader: { orientdb: { dbURL: 'memory:" + name.getMethodName() + "', dbType:'graph', useLightweightEdges:false } } }"); diff --git a/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLMergeTransformerTest.java b/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLMergeTransformerTest.java index 0d771be96c7..7b80cde1c29 100644 --- a/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLMergeTransformerTest.java +++ b/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLMergeTransformerTest.java @@ -107,10 +107,12 @@ public void shouldMergeVertexOnDuplitcatedInputSet() throws Exception { // CSV contains duplicated data configure( - "{source: { content: { value: 'num,name\n10000,FirstName\n10001,SecondName\n10000,FirstNameUpdated' } }, extractor : { csv: {} }," - + " transformers: [{merge: { joinFieldName:'num', lookup:'Person.num'}}, {vertex: {class:'Person', skipDuplicates: true}}]," - + " " - + "loader: { orientdb: { dbURL: 'memory:" + "{source: { content: { value: 'num,name\n" + + "10000,FirstName\n" + + "10001,SecondName\n" + + "10000,FirstNameUpdated' } }, extractor : { csv: {} }, transformers: [{merge: {" + + " joinFieldName:'num', lookup:'Person.num'}}, {vertex: {class:'Person'," + + " skipDuplicates: true}}], loader: { orientdb: { dbURL: 'memory:" + name.getMethodName() + "', dbType:'graph', useLightweightEdges:false } } }"); diff --git a/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLVertexTransformerTest.java b/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLVertexTransformerTest.java index e637b885896..556fb2c88a3 100644 --- a/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLVertexTransformerTest.java +++ b/etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLVertexTransformerTest.java @@ -46,9 +46,10 @@ public void createClasses(ODatabaseDocument db) { @Test public void testCreateVertex() { configure( - "{source: { content: { value: 'name,\nGregor' } }, extractor : { csv: {} }," - + " transformers: [{vertex: {class:'Person', skipDuplicates:false}}," - + "], loader: { orientdb: { dbAutoCreateProperties:true, cluster: 'custom', dbURL: 'memory:" + "{source: { content: { value: 'name,\n" + + "Gregor' } }, extractor : { csv: {} }, transformers: [{vertex: {class:'Person'," + + " skipDuplicates:false}},], loader: { orientdb: { dbAutoCreateProperties:true," + + " cluster: 'custom', dbURL: 'memory:" + name.getMethodName() + "', dbType:'graph', useLightweightEdges:false } } }"); @@ -70,10 +71,12 @@ public void testCreateVertex() { @Test public void testCreateTargetVertexIfNotExists() { configure( - "{source: { content: { value: 'name,idf,parent\nParent,1,\nChild,2,1' } }, extractor : { csv: {} }," - + " transformers: [{merge: { joinFieldName:'idf', lookup:'V.idf'}}, {vertex: {class:'V'}}," - + "{edge:{ class: 'E', joinFieldName: 'parent', lookup: 'V.idf', unresolvedLinkAction: 'CREATE' }, if: '$input.parent IS NOT NULL'}" - + "], loader: { orientdb: { dbURL: 'memory:" + "{source: { content: { value: 'name,idf,parent\n" + + "Parent,1,\n" + + "Child,2,1' } }, extractor : { csv: {} }, transformers: [{merge: {" + + " joinFieldName:'idf', lookup:'V.idf'}}, {vertex: {class:'V'}},{edge:{ class: 'E'," + + " joinFieldName: 'parent', lookup: 'V.idf', unresolvedLinkAction: 'CREATE' }, if:" + + " '$input.parent IS NOT NULL'}], loader: { orientdb: { dbURL: 'memory:" + name.getMethodName() + "', dbType:'graph', useLightweightEdges:false } } }"); @@ -95,9 +98,11 @@ public void testCreateTargetVertexIfNotExists() { @Test public void testErrorOnDuplicateVertex() { configure( - "{ config: { 'log': 'DEBUG' }, source: { content: { value: 'name,\nGregor\nGregor\nHans' } }, extractor : { csv: {} }," - + " transformers: [ {vertex: {class:'Person', skipDuplicates:false}}," - + "], loader: { orientdb: { dbURL: 'memory:" + "{ config: { 'log': 'DEBUG' }, source: { content: { value: 'name,\n" + + "Gregor\n" + + "Gregor\n" + + "Hans' } }, extractor : { csv: {} }, transformers: [ {vertex: {class:'Person'," + + " skipDuplicates:false}},], loader: { orientdb: { dbURL: 'memory:" + name.getMethodName() + "', dbType:'graph', useLightweightEdges:false } } }"); diff --git a/graphdb/pom.xml b/graphdb/pom.xml index 93e7ee57669..edd321b7624 100755 --- a/graphdb/pom.xml +++ b/graphdb/pom.xml @@ -36,6 +36,8 @@ ${maven.compiler.target} com.orientechnologies.orient.server.OServerMain UTF-8 + + 2023-01-01T00:00:00Z diff --git a/graphdb/src/main/java/com/orientechnologies/orient/graph/batch/OGraphBatchInsert.java b/graphdb/src/main/java/com/orientechnologies/orient/graph/batch/OGraphBatchInsert.java index 4d6dfe6bee1..9ccaf1008b5 100644 --- a/graphdb/src/main/java/com/orientechnologies/orient/graph/batch/OGraphBatchInsert.java +++ b/graphdb/src/main/java/com/orientechnologies/orient/graph/batch/OGraphBatchInsert.java @@ -424,32 +424,44 @@ public void setAverageEdgeNumberPerNode(final int averageEdgeNumberPerNode) { this.averageEdgeNumberPerNode = averageEdgeNumberPerNode; } - /** @return the property name where ids are written on vertices */ + /** + * @return the property name where ids are written on vertices + */ public String getIdPropertyName() { return idPropertyName; } - /** @param idPropertyName the property name where ids are written on vertices */ + /** + * @param idPropertyName the property name where ids are written on vertices + */ public void setIdPropertyName(final String idPropertyName) { this.idPropertyName = idPropertyName; } - /** @return the edge class name (E by default) */ + /** + * @return the edge class name (E by default) + */ public String getEdgeClass() { return edgeClass; } - /** @param edgeClass the edge class name */ + /** + * @param edgeClass the edge class name + */ public void setEdgeClass(final String edgeClass) { this.edgeClass = edgeClass; } - /** @return the vertex class name (V by default) */ + /** + * @return the vertex class name (V by default) + */ public String getVertexClass() { return vertexClass; } - /** @param vertexClass the vertex class name */ + /** + * @param vertexClass the vertex class name + */ public void setVertexClass(final String vertexClass) { this.vertexClass = vertexClass; } @@ -486,7 +498,9 @@ public void setEstimatedEntries(final int estimatedEntries) { this.estimatedEntries = estimatedEntries; } - /** @return number of parallel threads used for batch import */ + /** + * @return number of parallel threads used for batch import + */ public int getParallel() { return parallel; } diff --git a/graphdb/src/main/java/com/orientechnologies/orient/graph/batch/OGraphBatchInsertBasic.java b/graphdb/src/main/java/com/orientechnologies/orient/graph/batch/OGraphBatchInsertBasic.java index f3741a97434..0bc2c682986 100644 --- a/graphdb/src/main/java/com/orientechnologies/orient/graph/batch/OGraphBatchInsertBasic.java +++ b/graphdb/src/main/java/com/orientechnologies/orient/graph/batch/OGraphBatchInsertBasic.java @@ -296,32 +296,44 @@ public void setAverageEdgeNumberPerNode(final int averageEdgeNumberPerNode) { this.averageEdgeNumberPerNode = averageEdgeNumberPerNode; } - /** @return the property name where ids are written on vertices */ + /** + * @return the property name where ids are written on vertices + */ public String getIdPropertyName() { return idPropertyName; } - /** @param idPropertyName the property name where ids are written on vertices */ + /** + * @param idPropertyName the property name where ids are written on vertices + */ public void setIdPropertyName(final String idPropertyName) { this.idPropertyName = idPropertyName; } - /** @return the edge class name (E by default) */ + /** + * @return the edge class name (E by default) + */ public String getEdgeClass() { return edgeClass; } - /** @param edgeClass the edge class name */ + /** + * @param edgeClass the edge class name + */ public void setEdgeClass(final String edgeClass) { this.edgeClass = edgeClass; } - /** @return the vertex class name (V by default) */ + /** + * @return the vertex class name (V by default) + */ public String getVertexClass() { return vertexClass; } - /** @param vertexClass the vertex class name */ + /** + * @param vertexClass the vertex class name + */ public void setVertexClass(final String vertexClass) { this.vertexClass = vertexClass; } @@ -358,7 +370,9 @@ public void setEstimatedEntries(final int estimatedEntries) { this.estimatedEntries = estimatedEntries; } - /** @return number of parallel threads used for batch import */ + /** + * @return number of parallel threads used for batch import + */ public int getParallel() { return parallel; } diff --git a/graphdb/src/main/java/com/orientechnologies/orient/graph/console/OGremlinConsole.java b/graphdb/src/main/java/com/orientechnologies/orient/graph/console/OGremlinConsole.java index f393ba071ca..035fd6a1a85 100755 --- a/graphdb/src/main/java/com/orientechnologies/orient/graph/console/OGremlinConsole.java +++ b/graphdb/src/main/java/com/orientechnologies/orient/graph/console/OGremlinConsole.java @@ -307,7 +307,8 @@ public void repairDatabase( @ConsoleParameter( name = "options", description = - "Options: [--fix-graph] [--force-embedded-ridbags] [--fix-links] [-v]] [--fix-ridbags] [--fix-bonsai]", + "Options: [--fix-graph] [--force-embedded-ridbags] [--fix-links] [-v]]" + + " [--fix-ridbags] [--fix-bonsai]", optional = true) String iOptions) throws IOException { diff --git a/graphdb/src/main/java/com/orientechnologies/orient/graph/graphml/OGraphMLReader.java b/graphdb/src/main/java/com/orientechnologies/orient/graph/graphml/OGraphMLReader.java index 4ca8f3519c7..6abd73ce76d 100644 --- a/graphdb/src/main/java/com/orientechnologies/orient/graph/graphml/OGraphMLReader.java +++ b/graphdb/src/main/java/com/orientechnologies/orient/graph/graphml/OGraphMLReader.java @@ -65,7 +65,9 @@ public class OGraphMLReader { new HashMap(); private OCommandOutputListener output; - /** @param graph the graph to populate with the GraphML data */ + /** + * @param graph the graph to populate with the GraphML data + */ public OGraphMLReader(OrientBaseGraph graph) { this.graph = graph; } diff --git a/graphdb/src/main/java/com/orientechnologies/orient/graph/graphml/OGraphSONReader.java b/graphdb/src/main/java/com/orientechnologies/orient/graph/graphml/OGraphSONReader.java index 1a0c9e6e7d2..56f693214fb 100755 --- a/graphdb/src/main/java/com/orientechnologies/orient/graph/graphml/OGraphSONReader.java +++ b/graphdb/src/main/java/com/orientechnologies/orient/graph/graphml/OGraphSONReader.java @@ -34,7 +34,9 @@ public class OGraphSONReader { private OCommandOutputListener output; private long inputSize; - /** @param graph the graph to populate with the JSON data */ + /** + * @param graph the graph to populate with the JSON data + */ public OGraphSONReader(final Graph graph) { this.graph = graph; } @@ -182,7 +184,8 @@ protected void printStatus( if (inputSize > 0) output.onMessage( String.format( - "Imported %d graph elements: %d vertices and %d edges. Parsed %s/%s (uncompressed) (%s%%)", + "Imported %d graph elements: %d vertices and %d edges. Parsed %s/%s (uncompressed)" + + " (%s%%)", importedVertices + importedEdges, importedVertices, importedEdges, diff --git a/graphdb/src/main/java/com/orientechnologies/orient/graph/gremlin/OGremlinHelper.java b/graphdb/src/main/java/com/orientechnologies/orient/graph/gremlin/OGremlinHelper.java index 25d9738c302..18c02ad46c3 100755 --- a/graphdb/src/main/java/com/orientechnologies/orient/graph/gremlin/OGremlinHelper.java +++ b/graphdb/src/main/java/com/orientechnologies/orient/graph/gremlin/OGremlinHelper.java @@ -272,7 +272,8 @@ public static Object cloneObject(final Object objectToClone, final Object previo newClone = m[i].invoke(objectToClone); System.out.println( objectToClone.getClass() - + " cloned by Reflection. Performance can be improved by adding the class to the list of known types"); + + " cloned by Reflection. Performance can be improved by adding the class to" + + " the list of known types"); return newClone; } } @@ -297,7 +298,8 @@ public synchronized byte[] toByteArray() { new ObjectInputStream(new ByteArrayInputStream(bytes.toByteArray())); System.out.println( objectToClone.getClass() - + " cloned by Serialization. Performance can be improved by adding the class to the list of known types"); + + " cloned by Serialization. Performance can be improved by adding the class to" + + " the list of known types"); return in.readObject(); // *************************************************************************************************************************************** diff --git a/graphdb/src/main/java/com/orientechnologies/orient/graph/server/command/OServerCommandGetGephi.java b/graphdb/src/main/java/com/orientechnologies/orient/graph/server/command/OServerCommandGetGephi.java index 5153d06ac07..c752e2e299a 100644 --- a/graphdb/src/main/java/com/orientechnologies/orient/graph/server/command/OServerCommandGetGephi.java +++ b/graphdb/src/main/java/com/orientechnologies/orient/graph/server/command/OServerCommandGetGephi.java @@ -56,7 +56,10 @@ public boolean execute(final OHttpRequest iRequest, OHttpResponse iResponse) thr checkSyntax( iRequest.getUrl(), 4, - "Syntax error: gephi///[/][/].
    Limit is optional and is setted to 20 by default. Set expressely to 0 to have no limits."); + "Syntax error:" + + " gephi///[/][/].
    Limit is" + + " optional and is setted to 20 by default. Set expressely to 0 to have no" + + " limits."); final String language = urlParts[2]; final String text = urlParts[3]; diff --git a/graphdb/src/main/java/com/orientechnologies/orient/graph/sql/OGraphCommandExecutorSQLFactory.java b/graphdb/src/main/java/com/orientechnologies/orient/graph/sql/OGraphCommandExecutorSQLFactory.java index 606fbc9e4e5..9c74d53632e 100755 --- a/graphdb/src/main/java/com/orientechnologies/orient/graph/sql/OGraphCommandExecutorSQLFactory.java +++ b/graphdb/src/main/java/com/orientechnologies/orient/graph/sql/OGraphCommandExecutorSQLFactory.java @@ -230,7 +230,8 @@ public OCommandExecutorSQLAbstract createCommand(final String name) new OCommandExecutionException( "Error in creation of command " + name - + "(). Probably there is not an empty constructor or the constructor generates errors"), + + "(). Probably there is not an empty constructor or the constructor generates" + + " errors"), e); } } diff --git a/graphdb/src/main/java/com/orientechnologies/orient/graph/sql/functions/OSQLFunctionAstar.java b/graphdb/src/main/java/com/orientechnologies/orient/graph/sql/functions/OSQLFunctionAstar.java index cbd42166d49..14ffbf9defc 100755 --- a/graphdb/src/main/java/com/orientechnologies/orient/graph/sql/functions/OSQLFunctionAstar.java +++ b/graphdb/src/main/java/com/orientechnologies/orient/graph/sql/functions/OSQLFunctionAstar.java @@ -277,8 +277,10 @@ private void bindAdditionalParams(Object additionalParams, OSQLFunctionAstar ctx public String getSyntax() { return "astar(, , , []) \n" - + " // options : {direction:\"OUT\",edgeTypeNames:[] , vertexAxisNames:[] , parallel : false , " - + "tieBreaker:true,maxDepth:99999,dFactor:1.0,customHeuristicFormula:'custom_Function_Name_here' }"; + + " // options : {direction:\"OUT\",edgeTypeNames:[] , vertexAxisNames:[] ," + + " parallel : false ," + + " tieBreaker:true,maxDepth:99999,dFactor:1.0,customHeuristicFormula:'custom_Function_Name_here'" + + " }"; } @Override diff --git a/graphdb/src/main/java/com/orientechnologies/orient/graph/sql/functions/OSQLFunctionShortestPath.java b/graphdb/src/main/java/com/orientechnologies/orient/graph/sql/functions/OSQLFunctionShortestPath.java index 1a14188d73c..b6de2da993b 100644 --- a/graphdb/src/main/java/com/orientechnologies/orient/graph/sql/functions/OSQLFunctionShortestPath.java +++ b/graphdb/src/main/java/com/orientechnologies/orient/graph/sql/functions/OSQLFunctionShortestPath.java @@ -247,7 +247,8 @@ private Integer integer(Object fromObject) { } public String getSyntax() { - return "shortestPath(, , [, [ ]])"; + return "shortestPath(, , [, [ " + + " ]])"; } protected List walkLeft(final OSQLFunctionShortestPath.OShortestPathContext ctx) { diff --git a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientBaseGraph.java b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientBaseGraph.java index c83515babfc..9bdc77d63ec 100755 --- a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientBaseGraph.java +++ b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientBaseGraph.java @@ -1865,7 +1865,9 @@ public RET executeOutsideTx( OLogManager.instance() .warn( this, - "Requested command '%s' must be executed outside active transaction: the transaction will be committed and reopen right after it. To avoid this behavior execute it outside a transaction", + "Requested command '%s' must be executed outside active transaction: the" + + " transaction will be committed and reopen right after it. To avoid this" + + " behavior execute it outside a transaction", msg.toString()); } committed = raw.getTransaction().amountOfNestedTxs(); @@ -1916,7 +1918,8 @@ else if (types.length == 1) { } } else { throw new IllegalArgumentException( - "Cannot build a composite key from the input. The size of the parameters is major than the number indexed fields"); + "Cannot build a composite key from the input. The size of the parameters is major" + + " than the number indexed fields"); } iValue = new OCompositeKey(keys); } diff --git a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientDynaElementIterable.java b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientDynaElementIterable.java index 4905ad851de..2ec725b69a4 100644 --- a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientDynaElementIterable.java +++ b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientDynaElementIterable.java @@ -23,7 +23,9 @@ import com.tinkerpop.blueprints.CloseableIterable; import java.util.Iterator; -/** @author Luca Garulli (l.garulli--(at)--orientdb.com) (http://orientdb.com) */ +/** + * @author Luca Garulli (l.garulli--(at)--orientdb.com) (http://orientdb.com) + */ public class OrientDynaElementIterable implements CloseableIterable { private final Iterator iterator; diff --git a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientDynaElementIterator.java b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientDynaElementIterator.java index 1e8f2899776..55456e76b74 100644 --- a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientDynaElementIterator.java +++ b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientDynaElementIterator.java @@ -27,7 +27,9 @@ import java.util.Iterator; import java.util.NoSuchElementException; -/** @author Luca Garulli (l.garulli--(at)--orientdb.com) (http://orientdb.com) */ +/** + * @author Luca Garulli (l.garulli--(at)--orientdb.com) (http://orientdb.com) + */ class OrientDynaElementIterator implements Iterator { private final Iterator itty; diff --git a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientEdgeIterator.java b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientEdgeIterator.java index f78d9ab9589..2f679b111f5 100755 --- a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientEdgeIterator.java +++ b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientEdgeIterator.java @@ -82,7 +82,8 @@ public OrientEdge createGraphElement(final Object iObject) { OLogManager.instance() .warn( this, - "Found a record (%s) that is not an edge. Source vertex : %s, Target vertex : %s, Database : %s", + "Found a record (%s) that is not an edge. Source vertex : %s, Target vertex : %s," + + " Database : %s", rec, sourceVertex != null ? sourceVertex.getIdentity() : null, targetVertex != null ? targetVertex.getIdentity() : null, diff --git a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientElement.java b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientElement.java index 07f29ed4aaa..faa69392d09 100755 --- a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientElement.java +++ b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientElement.java @@ -615,7 +615,8 @@ public OClass call(final OrientBaseGraph g) { className, "' as subclass of '", getBaseClassName(), - "'. The transaction will be reopen right after that. To avoid this behavior create the classes outside the transaction"); + "'. The transaction will be reopen right after that. To avoid this behavior create the" + + " classes outside the transaction"); } catch (OSchemaException e) { if (!schema.existsClass(className)) throw e; @@ -647,7 +648,8 @@ protected OrientBaseGraph checkIfAttached() { final OrientBaseGraph graph = getGraph(); if (graph == null) throw new IllegalStateException( - "There is no active graph instance for current element. Please either open connection to your storage, or use detach/attach methods instead."); + "There is no active graph instance for current element. Please either open connection to" + + " your storage, or use detach/attach methods instead."); return graph; } @@ -688,7 +690,8 @@ protected T setPropertiesInternal(final Object... fiel for (Object o : (Collection) f) { if (!(o instanceof OPair)) throw new IllegalArgumentException( - "Invalid fields: expecting a pairs of fields as String,Object, but found the item: " + "Invalid fields: expecting a pairs of fields as String,Object, but found the" + + " item: " + o); final OPair entry = (OPair) o; @@ -701,12 +704,14 @@ protected T setPropertiesInternal(final Object... fiel } else throw new IllegalArgumentException( - "Invalid fields: expecting a pairs of fields as String,Object or a single Map, but found: " + "Invalid fields: expecting a pairs of fields as String,Object or a single" + + " Map, but found: " + f); } else { if (fields.length % 2 != 0) throw new IllegalArgumentException( - "Invalid fields: expecting a pairs of fields as String,Object or a single Map, but found: " + "Invalid fields: expecting a pairs of fields as String,Object or a single" + + " Map, but found: " + Arrays.toString(fields)); // SET THE FIELDS diff --git a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientElementIterable.java b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientElementIterable.java index 06b0d1a0d06..4723396de0e 100644 --- a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientElementIterable.java +++ b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientElementIterable.java @@ -25,7 +25,9 @@ import java.util.Collections; import java.util.Iterator; -/** @author Marko A. Rodriguez (http://markorodriguez.com) */ +/** + * @author Marko A. Rodriguez (http://markorodriguez.com) + */ public class OrientElementIterable implements CloseableIterable { private final Iterable iterable; diff --git a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientElementIterator.java b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientElementIterator.java index 04c28742948..261915ff3a7 100644 --- a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientElementIterator.java +++ b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientElementIterator.java @@ -28,7 +28,9 @@ import java.util.Iterator; import java.util.NoSuchElementException; -/** @author Marko A. Rodriguez (http://markorodriguez.com) */ +/** + * @author Marko A. Rodriguez (http://markorodriguez.com) + */ class OrientElementIterator implements Iterator { private final Iterator itty; @@ -66,7 +68,8 @@ public T next() { // projection a vertex if (immutableClass == null && currentDocument.getIdentity().getClusterId() != -2) throw new IllegalArgumentException( - "Cannot determine the graph element type because the document class is null. Probably this is a projection, use the EXPAND() function"); + "Cannot determine the graph element type because the document class is null. Probably" + + " this is a projection, use the EXPAND() function"); if (currentDocument.getIdentity().getClusterId() != -2 && immutableClass.isEdgeType()) currentElement = graph.getEdge(currentDocument); diff --git a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientElementScanIterable.java b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientElementScanIterable.java index e37efcac186..28edfbe596e 100644 --- a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientElementScanIterable.java +++ b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientElementScanIterable.java @@ -27,7 +27,9 @@ import com.tinkerpop.blueprints.Element; import java.util.Iterator; -/** @author Luca Garulli (l.garulli--(at)--orientdb.com) (http://orientdb.com) */ +/** + * @author Luca Garulli (l.garulli--(at)--orientdb.com) (http://orientdb.com) + */ class OrientElementScanIterable implements CloseableIterable { private final String elementClass; private final OrientBaseGraph graph; diff --git a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientIndexAuto.java b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientIndexAuto.java index 4832d481172..7c65d961fc7 100644 --- a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientIndexAuto.java +++ b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientIndexAuto.java @@ -101,7 +101,8 @@ public static OrientIndexAuto load( throw new IllegalArgumentException( "Index class '" + className - + "' is not registered. Supported ones: Vertex, Edge and custom class that extends them", + + "' is not registered. Supported ones: Vertex, Edge and custom class that extends" + + " them", e); } } diff --git a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientIndexManual.java b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientIndexManual.java index 655edc89e32..7730d42d335 100644 --- a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientIndexManual.java +++ b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientIndexManual.java @@ -42,7 +42,9 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -/** @author Luca Garulli (l.garulli--(at)--orientdb.com) (http://orientdb.com) */ +/** + * @author Luca Garulli (l.garulli--(at)--orientdb.com) (http://orientdb.com) + */ @SuppressWarnings("unchecked") public class OrientIndexManual implements OrientIndex { public static final String CONFIG_CLASSNAME = "blueprintsIndexClass"; @@ -247,7 +249,8 @@ private void load(final ODocument metadata) { throw new IllegalArgumentException( "Index class '" + indexClassName - + "' is not registered. Supported ones: Vertex, Edge and custom class that extends them", + + "' is not registered. Supported ones: Vertex, Edge and custom class that extends" + + " them", e); } diff --git a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientTransactionalGraph.java b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientTransactionalGraph.java index 03d957433cc..c05509a14d9 100644 --- a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientTransactionalGraph.java +++ b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientTransactionalGraph.java @@ -152,8 +152,9 @@ && getDatabase().getTransaction().isActive()) { OLogManager.instance() .warn( this, - "Auto Transaction for graphs setting has been turned off, but a transaction was already started." - + " Commit it manually or consider disabling auto transactions while creating the graph."); + "Auto Transaction for graphs setting has been turned off, but a transaction was" + + " already started. Commit it manually or consider disabling auto transactions" + + " while creating the graph."); } /** diff --git a/graphdb/src/test/java/com/orientechnologies/orient/graph/GraphNonBlockingQueryRemoteTest.java b/graphdb/src/test/java/com/orientechnologies/orient/graph/GraphNonBlockingQueryRemoteTest.java index 8c0ae28edba..2d35084235e 100755 --- a/graphdb/src/test/java/com/orientechnologies/orient/graph/GraphNonBlockingQueryRemoteTest.java +++ b/graphdb/src/test/java/com/orientechnologies/orient/graph/GraphNonBlockingQueryRemoteTest.java @@ -40,9 +40,16 @@ public class GraphNonBlockingQueryRemoteTest { @Before public void before() - throws ClassNotFoundException, MalformedObjectNameException, InstanceAlreadyExistsException, - NotCompliantMBeanException, MBeanRegistrationException, InvocationTargetException, - NoSuchMethodException, InstantiationException, IOException, IllegalAccessException { + throws ClassNotFoundException, + MalformedObjectNameException, + InstanceAlreadyExistsException, + NotCompliantMBeanException, + MBeanRegistrationException, + InvocationTargetException, + NoSuchMethodException, + InstantiationException, + IOException, + IllegalAccessException { final String buildDirectory = System.getProperty("buildDirectory", "."); serverHome = buildDirectory + "/" + GraphNonBlockingQueryRemoteTest.class.getSimpleName(); diff --git a/graphdb/src/test/java/com/orientechnologies/orient/graph/GraphRecoveringTest.java b/graphdb/src/test/java/com/orientechnologies/orient/graph/GraphRecoveringTest.java index 6ae725bac4e..881d06ad655 100644 --- a/graphdb/src/test/java/com/orientechnologies/orient/graph/GraphRecoveringTest.java +++ b/graphdb/src/test/java/com/orientechnologies/orient/graph/GraphRecoveringTest.java @@ -53,7 +53,8 @@ public void onRemovedLink(OIdentifiable link) { public void onRepairedVertex(ODocument vertex) { repairedVertices++; } - }; + } + ; private void init(OrientBaseGraph g, boolean lightweight) { g.setUseLightweightEdges(lightweight); diff --git a/graphdb/src/test/java/com/orientechnologies/orient/graph/GraphTransactionOnBatchTest.java b/graphdb/src/test/java/com/orientechnologies/orient/graph/GraphTransactionOnBatchTest.java index a770ff9e39f..eaa8321148c 100644 --- a/graphdb/src/test/java/com/orientechnologies/orient/graph/GraphTransactionOnBatchTest.java +++ b/graphdb/src/test/java/com/orientechnologies/orient/graph/GraphTransactionOnBatchTest.java @@ -43,7 +43,12 @@ public void testDuplicateRollback() { try { db.execute( "sql", - "BEGIN \n; LET a = create vertex Test SET id = \"12345678\" \n; LET b = create vertex Test SET id = \"4kkrPhGe\" \n; LET c =create vertex Test SET id = \"4kkrPhGe\" \n; COMMIT \n; RETURN $b ;") + "BEGIN \n" + + "; LET a = create vertex Test SET id = \"12345678\" \n" + + "; LET b = create vertex Test SET id = \"4kkrPhGe\" \n" + + "; LET c =create vertex Test SET id = \"4kkrPhGe\" \n" + + "; COMMIT \n" + + "; RETURN $b ;") .close(); Assert.fail("expected record duplicate exception"); } catch (ORecordDuplicatedException ex) { @@ -52,7 +57,12 @@ public void testDuplicateRollback() { try { db.execute( "sql", - "BEGIN \n; LET a = create vertex Test content {\"id\": \"12345678\"} \n; LET b = create vertex Test content {\"id\": \"4kkrPhGe\"} \n; LET c =create vertex Test content { \"id\": \"4kkrPhGe\"} \n; COMMIT \n; RETURN $b ;") + "BEGIN \n" + + "; LET a = create vertex Test content {\"id\": \"12345678\"} \n" + + "; LET b = create vertex Test content {\"id\": \"4kkrPhGe\"} \n" + + "; LET c =create vertex Test content { \"id\": \"4kkrPhGe\"} \n" + + "; COMMIT \n" + + "; RETURN $b ;") .close(); Assert.fail("expected record duplicate exception"); } catch (ORecordDuplicatedException ex) { @@ -91,7 +101,12 @@ public void testDuplicateEdgeRollback() { try { db.execute( "sql", - "BEGIN; \n; LET a = create vertex V \n; LET b = create vertex V ;\n LET c =create edge Test from $a to $b SET aKey = \"12345\" ;\n LET d =create edge Test from $a to $b SET aKey = \"12345\" ;\n COMMIT ;\n" + "BEGIN; \n" + + "; LET a = create vertex V \n" + + "; LET b = create vertex V ;\n" + + " LET c =create edge Test from $a to $b SET aKey = \"12345\" ;\n" + + " LET d =create edge Test from $a to $b SET aKey = \"12345\" ;\n" + + " COMMIT ;\n" + " RETURN $c") .close(); Assert.fail("expected record duplicate exception"); @@ -112,8 +127,13 @@ public void testAbsoluteDuplicateEdgeRollback() { try { db.execute( "sql", - "BEGIN \n; LET a = create vertex V \n; LET b = create vertex V \n; LET c =create edge Test from $a to $b \n; LET d =create edge Test from $a to $b \n; COMMIT \n;" - + " RETURN $c") + "BEGIN \n" + + "; LET a = create vertex V \n" + + "; LET b = create vertex V \n" + + "; LET c =create edge Test from $a to $b \n" + + "; LET d =create edge Test from $a to $b \n" + + "; COMMIT \n" + + "; RETURN $c") .close(); Assert.fail("expected record duplicate exception"); } catch (ORecordDuplicatedException ex) { @@ -133,14 +153,22 @@ public void testAbsoluteDuplicateEdgeAlreadyPresentRollback() { try { db.execute( "sql", - "BEGIN \n; LET a = create vertex V set name='a' \n; LET b = create vertex V set name='b' \n; LET c =create edge Test from $a to $b \n; LET d =create edge Test from $a to $b \n; COMMIT \n;" - + " RETURN $c") + "BEGIN \n" + + "; LET a = create vertex V set name='a' \n" + + "; LET b = create vertex V set name='b' \n" + + "; LET c =create edge Test from $a to $b \n" + + "; LET d =create edge Test from $a to $b \n" + + "; COMMIT \n" + + "; RETURN $c") .close(); db.execute( "sql", - "BEGIN \n; LET c =create edge Test from (select from V where name='a') to (select from V where name='b') \n; COMMIT \n;" - + " RETURN $c") + "BEGIN \n" + + "; LET c =create edge Test from (select from V where name='a') to (select from" + + " V where name='b') \n" + + "; COMMIT \n" + + "; RETURN $c") .close(); Assert.fail("expected record duplicate exception"); } catch (ORecordDuplicatedException ex) { @@ -157,14 +185,22 @@ public void testDuplicateEdgeAlreadyPresentRollback() { clazz.createProperty("aKey", OType.STRING).createIndex(INDEX_TYPE.UNIQUE); db.execute( "sql", - "BEGIN \n; LET a = create vertex V \n; LET b = create vertex V \n; LET c =create edge Test from $a to $b SET aKey = \"12345\" \n; commit \n;" - + " RETURN $c") + "BEGIN \n" + + "; LET a = create vertex V \n" + + "; LET b = create vertex V \n" + + "; LET c =create edge Test from $a to $b SET aKey = \"12345\" \n" + + "; commit \n" + + "; RETURN $c") .close(); try { db.execute( "sql", - "BEGIN \n; LET a = create vertex V \n; LET b = create vertex V \n; LET c =create edge Test from $a to $b SET aKey = \"12345\"\n; COMMIT \n;" - + " RETURN $c") + "BEGIN \n" + + "; LET a = create vertex V \n" + + "; LET b = create vertex V \n" + + "; LET c =create edge Test from $a to $b SET aKey = \"12345\"\n" + + "; COMMIT \n" + + "; RETURN $c") .close(); Assert.fail("expected record duplicate exception"); } catch (ORecordDuplicatedException ex) { @@ -180,9 +216,13 @@ public void testReferInTxDeleteVertex() { db.command("create vertex V set Mid = '1' ").close(); db.execute( "sql", - "begin \n; LET t0 = select from V where Mid='1' \n;" - + "LET t1 = delete vertex V where Mid = '1' \n; LET t2 = create vertex V set Mid = '2' \n;" - + "LET t4 = create edge E from $t2 to $t0 \n; commit \n; return [$t4] ") + "begin \n" + + "; LET t0 = select from V where Mid='1' \n" + + ";LET t1 = delete vertex V where Mid = '1' \n" + + "; LET t2 = create vertex V set Mid = '2' \n" + + ";LET t4 = create edge E from $t2 to $t0 \n" + + "; commit \n" + + "; return [$t4] ") .close(); Assert.fail("it should go in exception because referring to a in transaction delete vertex"); } catch (Exception ex) { @@ -198,9 +238,13 @@ public void testReferToInTxCreatedAndDeletedVertex() { try { db.execute( "sql", - "begin \n; LET t0 = create vertex V set Mid = '1' \n;" - + "LET t1 = delete vertex V where Mid = '1' \n; LET t2 = create vertex V set Mid = '2' \n;" - + "LET t4 = create edge E from $t2 to $t0 \n; commit \n; return [$t4] ") + "begin \n" + + "; LET t0 = create vertex V set Mid = '1' \n" + + ";LET t1 = delete vertex V where Mid = '1' \n" + + "; LET t2 = create vertex V set Mid = '2' \n" + + ";LET t4 = create edge E from $t2 to $t0 \n" + + "; commit \n" + + "; return [$t4] ") .close(); Assert.fail("it should go in exception because referring to a in transaction delete vertex"); } catch (Exception ex) { @@ -220,9 +264,14 @@ public void testReferToNotExistingVertex() { db.command( new OCommandScript( "sql", - "begin \n \n LET t2 = create vertex V set Mid = \"2\" \n" - + "LET t5 = select from V where Mid = '123456789' \n LET t3 = create edge E from $t5 to $t2 \n" - + "\n commit \n return [$t3] ")) + "begin \n" + + " \n" + + " LET t2 = create vertex V set Mid = \"2\" \n" + + "LET t5 = select from V where Mid = '123456789' \n" + + " LET t3 = create edge E from $t5 to $t2 \n" + + "\n" + + " commit \n" + + " return [$t3] ")) .execute(); Assert.fail(); } catch (OCommandExecutionException e) { @@ -243,7 +292,11 @@ public void testReferToNotExistingVariableInTx() { db.command( new OCommandScript( "sql", - "begin \n Let t0 = delete vertex V where Mid='2' \n LET t1 = create edge E from $t2 to $t3 \n commit \n return $t1 ")) + "begin \n" + + " Let t0 = delete vertex V where Mid='2' \n" + + " LET t1 = create edge E from $t2 to $t3 \n" + + " commit \n" + + " return $t1 ")) .execute(); Assert.fail("it should go in exception because referring to not existing variable"); } catch (Exception ex) { diff --git a/graphdb/src/test/java/com/orientechnologies/orient/graph/ODatabaseFailDueCloseTest.java b/graphdb/src/test/java/com/orientechnologies/orient/graph/ODatabaseFailDueCloseTest.java index 3ddf49f2fef..755a8aa9059 100644 --- a/graphdb/src/test/java/com/orientechnologies/orient/graph/ODatabaseFailDueCloseTest.java +++ b/graphdb/src/test/java/com/orientechnologies/orient/graph/ODatabaseFailDueCloseTest.java @@ -66,7 +66,8 @@ public void test1() { try { String queryText = - "SELECT @rid as rid, localName FROM Person WHERE ( 'milano' IN out('lives').localName OR 'roma' IN out('lives').localName ) ORDER BY age ASC"; + "SELECT @rid as rid, localName FROM Person WHERE ( 'milano' IN out('lives').localName OR" + + " 'roma' IN out('lives').localName ) ORDER BY age ASC"; OSQLSynchQuery query = new OSQLSynchQuery(queryText); List results = graph.getRawGraph().query(query); assertNotNull(results); diff --git a/graphdb/src/test/java/com/orientechnologies/orient/graph/batch/OGraphBatchInsertTest.java b/graphdb/src/test/java/com/orientechnologies/orient/graph/batch/OGraphBatchInsertTest.java index 4d7ff0b4308..0c4fb98cf62 100644 --- a/graphdb/src/test/java/com/orientechnologies/orient/graph/batch/OGraphBatchInsertTest.java +++ b/graphdb/src/test/java/com/orientechnologies/orient/graph/batch/OGraphBatchInsertTest.java @@ -11,7 +11,9 @@ import junit.framework.TestCase; import org.junit.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) (l.dellaquila-at-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) (l.dellaquila-at-orientdb.com) + */ public class OGraphBatchInsertTest extends TestCase { @Test @@ -218,7 +220,8 @@ public void testHoles() { Iterable result = g.command( new OSQLSynchQuery( - "select expand(out().in().out().out().in().out().out().in().out()) from V where uid = ?")) + "select expand(out().in().out().out().in().out().out().in().out()) from V where" + + " uid = ?")) .execute(0L); boolean found = false; diff --git a/graphdb/src/test/java/com/orientechnologies/orient/graph/batch/OGraphImporterBasicAPITest.java b/graphdb/src/test/java/com/orientechnologies/orient/graph/batch/OGraphImporterBasicAPITest.java index ba46ce56e5b..faa9545743e 100755 --- a/graphdb/src/test/java/com/orientechnologies/orient/graph/batch/OGraphImporterBasicAPITest.java +++ b/graphdb/src/test/java/com/orientechnologies/orient/graph/batch/OGraphImporterBasicAPITest.java @@ -18,7 +18,9 @@ import java.util.Map; import java.util.stream.Stream; -/** @author Luca Garulli */ +/** + * @author Luca Garulli + */ public class OGraphImporterBasicAPITest { static int row = 0; static long lastVertexCount = 0; diff --git a/graphdb/src/test/java/com/orientechnologies/orient/graph/blueprints/EdgeBug.java b/graphdb/src/test/java/com/orientechnologies/orient/graph/blueprints/EdgeBug.java index b2d67f1a338..807e383100f 100644 --- a/graphdb/src/test/java/com/orientechnologies/orient/graph/blueprints/EdgeBug.java +++ b/graphdb/src/test/java/com/orientechnologies/orient/graph/blueprints/EdgeBug.java @@ -34,31 +34,23 @@ public void run() throws Exception { private OServer setupDatabase() throws Exception { OServer ret = new OServer(false); ret.startup( - "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" + "" + "true"); return ret; } diff --git a/graphdb/src/test/java/com/orientechnologies/orient/graph/blueprints/EdgeSaveShouldNotReinsertVerticesTest.java b/graphdb/src/test/java/com/orientechnologies/orient/graph/blueprints/EdgeSaveShouldNotReinsertVerticesTest.java index 3aa05722439..8da5c7a5c7a 100755 --- a/graphdb/src/test/java/com/orientechnologies/orient/graph/blueprints/EdgeSaveShouldNotReinsertVerticesTest.java +++ b/graphdb/src/test/java/com/orientechnologies/orient/graph/blueprints/EdgeSaveShouldNotReinsertVerticesTest.java @@ -28,7 +28,9 @@ import org.junit.Before; import org.junit.Test; -/** @author Sergey Sitnikov */ +/** + * @author Sergey Sitnikov + */ public class EdgeSaveShouldNotReinsertVerticesTest { private OrientGraphFactory factory; diff --git a/graphdb/src/test/java/com/orientechnologies/orient/graph/console/OGremlinConsoleTest.java b/graphdb/src/test/java/com/orientechnologies/orient/graph/console/OGremlinConsoleTest.java index 2e6c5c418d4..e9446a080a2 100644 --- a/graphdb/src/test/java/com/orientechnologies/orient/graph/console/OGremlinConsoleTest.java +++ b/graphdb/src/test/java/com/orientechnologies/orient/graph/console/OGremlinConsoleTest.java @@ -69,7 +69,8 @@ public void testGraphMLImport() { StringBuilder builder = new StringBuilder(); builder.append("connect env embedded:./target/ root root;\n"); builder.append( - "create database testGraphMLImport memory users (admin identified by 'admin' role admin);\n"); + "create database testGraphMLImport memory users (admin identified by 'admin' role" + + " admin);\n"); builder.append("open testGraphMLImport admin admin;\n"); builder.append("import database " + INPUT_FILE + ";\n"); @@ -100,7 +101,8 @@ public void testGraphMLExport() { StringBuilder builder = new StringBuilder(); builder.append("connect env embedded:./target/ root root;\n"); builder.append( - "create database testGraphMLExport memory users (admin identified by 'admin' role admin);\n"); + "create database testGraphMLExport memory users (admin identified by 'admin' role" + + " admin);\n"); builder.append("open testGraphMLExport admin admin;\n"); builder.append("import database " + INPUT_FILE + ";\n"); @@ -125,7 +127,8 @@ public void testMoveVertexCommand() { StringBuilder builder = new StringBuilder(); builder.append("connect env embedded:./target/ root root;\n"); builder.append( - "create database testMoveVertexCommand memory users (admin identified by 'admin' role admin);\n"); + "create database testMoveVertexCommand memory users (admin identified by 'admin' role" + + " admin);\n"); builder.append("open testMoveVertexCommand admin admin;\n"); builder.append("import database " + INPUT_FILE + " batchSize=10;\n"); builder.append("create class newposition extends V;\n"); @@ -188,7 +191,8 @@ public void testGraphMLImportWithSmallBatch() { StringBuilder builder = new StringBuilder(); builder.append("connect env embedded:./target/ root root;\n"); builder.append( - "create database testGraphMLImportWithSmallBatch memory users (admin identified by 'admin' role admin);\n"); + "create database testGraphMLImportWithSmallBatch memory users (admin identified by 'admin'" + + " role admin);\n"); builder.append("open testGraphMLImportWithSmallBatch admin admin;\n"); builder.append("import database " + INPUT_FILE + " batchSize=10;\n"); OConsoleDatabaseApp console = new TestOGremlinConsole(new String[] {builder.toString()}); @@ -365,7 +369,8 @@ public void testSimple() { StringBuilder builder = new StringBuilder(); builder.append("connect env embedded:./target/ root root;\n"); builder.append( - "create database OConsoleDatabaseAppTest memory users (admin identified by 'admin' role admin);\n"); + "create database OConsoleDatabaseAppTest memory users (admin identified by 'admin' role" + + " admin);\n"); builder.append("open OConsoleDatabaseAppTest admin admin;\n"); builder.append("profile storage on;\n"); builder.append("create class foo;\n"); @@ -400,7 +405,8 @@ public void testSimple() { builder.append("traverse out() from V;\n"); builder.append( - "create edge from (select from V where name = 'foo') to (select from V where name = 'bar');\n"); + "create edge from (select from V where name = 'foo') to (select from V where name =" + + " 'bar');\n"); builder.append("traverse out() from V;\n"); diff --git a/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/GraphCreateEdgeWithoutClassTest.java b/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/GraphCreateEdgeWithoutClassTest.java index dd94c8acb5b..a645ca1df9f 100755 --- a/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/GraphCreateEdgeWithoutClassTest.java +++ b/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/GraphCreateEdgeWithoutClassTest.java @@ -29,7 +29,8 @@ public void testCreateEdgeWithoutClass() { graph.createEdgeType("FooBar"); graph .sqlCommand( - "create edge FooBar from (select from V where name='foo') to (select from V where name = 'bar')") + "create edge FooBar from (select from V where name='foo') to (select from V where" + + " name = 'bar')") .close(); graph.commit(); @@ -37,7 +38,8 @@ public void testCreateEdgeWithoutClass() { graph .command( new OSQLSynchQuery( - "select out as f1, out_ as f2, out_edgetestedge as f3, out_FooBar as f4, outE() as f5 from v where name = 'foo'")) + "select out as f1, out_ as f2, out_edgetestedge as f3, out_FooBar as f4," + + " outE() as f5 from v where name = 'foo'")) .execute(); boolean found = false; diff --git a/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/GraphIntersectLightweightEdges.java b/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/GraphIntersectLightweightEdges.java index 8d7a6941ec6..991dd3a3f7d 100755 --- a/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/GraphIntersectLightweightEdges.java +++ b/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/GraphIntersectLightweightEdges.java @@ -106,7 +106,8 @@ public void testIntersect() { graph .command( new OCommandSQL( - "select expand($c) let $a=(select from V limit 20), $b=(select from V skip 10 limit 10), $c=intersect( $a, $b )")) + "select expand($c) let $a=(select from V limit 20), $b=(select from V skip 10" + + " limit 10), $c=intersect( $a, $b )")) .execute(); Assert.assertTrue(result.iterator().hasNext()); diff --git a/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/GraphUnwindOutTest.java b/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/GraphUnwindOutTest.java index a61bd244bda..8fde238a3b9 100644 --- a/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/GraphUnwindOutTest.java +++ b/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/GraphUnwindOutTest.java @@ -40,14 +40,16 @@ public void testUwindLightweightEdges() { graph.commit(); graph .sqlCommand( - "create edge edgetestedge from (select from edgetest where ida='parentckt1') to (select from edgetest where ida like 'childckt%')") + "create edge edgetestedge from (select from edgetest where ida='parentckt1') to" + + " (select from edgetest where ida like 'childckt%')") .close(); graph.commit(); Iterable res = graph .command( new OSQLSynchQuery( - "select out_edgetestedge[0] from v where out_edgetestedge.size() > 0 unwind out_edgetestedge ")) + "select out_edgetestedge[0] from v where out_edgetestedge.size() > 0 unwind" + + " out_edgetestedge ")) .execute(); for (OrientElement oDocument : res) { diff --git a/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/OutInChainTest.java b/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/OutInChainTest.java index 48ae433a957..85c20d13e66 100644 --- a/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/OutInChainTest.java +++ b/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/OutInChainTest.java @@ -77,11 +77,13 @@ public void testMultipleLabels() { graph .sqlCommand( - "create edge E1 from (select from V1 where name = '1') to (select from V1 where name = '2')") + "create edge E1 from (select from V1 where name = '1') to (select from V1 where name =" + + " '2')") .close(); graph .sqlCommand( - "create edge E2 from (select from V1 where name = '1') to (select from V1 where name = '3')") + "create edge E2 from (select from V1 where name = '1') to (select from V1 where name =" + + " '3')") .close(); Iterable result = diff --git a/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/SQLGraphFunctionsTest.java b/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/SQLGraphFunctionsTest.java index a5c80bb5068..9a7411f2b45 100644 --- a/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/SQLGraphFunctionsTest.java +++ b/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/SQLGraphFunctionsTest.java @@ -69,7 +69,8 @@ public static void afterClass() { @Test public void checkDijkstra() { String subquery = - "select $current, $target, Dijkstra($current, $target , 'weight') as path from V let $target = ( select from V where name = \'C\' ) where 1 > 0"; + "select $current, $target, Dijkstra($current, $target , 'weight') as path from V let" + + " $target = ( select from V where name = \'C\' ) where 1 > 0"; Iterable result = graph.command(new OSQLSynchQuery(subquery)).execute(); Assert.assertTrue(result.iterator().hasNext()); diff --git a/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/SQLMoveVertexCommandInTxTest.java b/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/SQLMoveVertexCommandInTxTest.java index e5ce73be44c..eefba6095ee 100755 --- a/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/SQLMoveVertexCommandInTxTest.java +++ b/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/SQLMoveVertexCommandInTxTest.java @@ -183,7 +183,8 @@ public void testMoveMultipleRecordToAnotherCluster() { graph .command( new OCommandSQL( - "MOVE VERTEX (select from Customer where workedOn = 'Amiga') TO CLUSTER:Customer_genius")) + "MOVE VERTEX (select from Customer where workedOn = 'Amiga') TO" + + " CLUSTER:Customer_genius")) .execute(); // CHECK RESULT @@ -294,7 +295,8 @@ public void testMoveBatch() { graph .command( new OCommandSQL( - "MOVE VERTEX (select from Customer where testMoveBatch = true) TO CLASS:Provider BATCH 10")) + "MOVE VERTEX (select from Customer where testMoveBatch = true) TO" + + " CLASS:Provider BATCH 10")) .execute(); // CHECK RESULT diff --git a/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/SQLMoveVertexCommandTest.java b/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/SQLMoveVertexCommandTest.java index d2921e60018..943127447f0 100755 --- a/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/SQLMoveVertexCommandTest.java +++ b/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/SQLMoveVertexCommandTest.java @@ -204,7 +204,8 @@ public void testMoveMultipleRecordToAnotherCluster() { graph .command( new OCommandSQL( - "MOVE VERTEX (select from Customer where workedOn = 'Amiga') TO CLUSTER:Customer_genius")) + "MOVE VERTEX (select from Customer where workedOn = 'Amiga') TO" + + " CLUSTER:Customer_genius")) .execute(); // CHECK RESULT @@ -312,7 +313,8 @@ public void testMoveMultipleRecordToAnotherClassInTxSettingProperties() { graph .command( new OCommandSQL( - "MOVE VERTEX (select from Customer where city = 'Rome') TO CLASS:Provider SET a='test3', b=5")) + "MOVE VERTEX (select from Customer where city = 'Rome') TO CLASS:Provider SET" + + " a='test3', b=5")) .execute(); // CHECK RESULT diff --git a/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/functions/OSQLFunctionAstarTest.java b/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/functions/OSQLFunctionAstarTest.java index 61e1e7c10f7..e2422716855 100644 --- a/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/functions/OSQLFunctionAstarTest.java +++ b/graphdb/src/test/java/com/orientechnologies/orient/graph/sql/functions/OSQLFunctionAstarTest.java @@ -462,7 +462,8 @@ public void testSql() { + v1.getId() + ", " + v4.getId() - + ", 'weight', {'direction':'out', 'parallel':true, 'edgeTypeNames':'has_path'}))")) + + ", 'weight', {'direction':'out', 'parallel':true," + + " 'edgeTypeNames':'has_path'}))")) .execute(); List result = new ArrayList(); diff --git a/graphdb/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpGephiTest.java b/graphdb/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpGephiTest.java index 1a110a316b3..778b7e20309 100755 --- a/graphdb/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpGephiTest.java +++ b/graphdb/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpGephiTest.java @@ -67,7 +67,8 @@ public void createDatabase() throws Exception { Assert.assertEquals( post("command/" + getDatabaseName() + "/sql/") .payload( - "{\"command\":\"create edge from (select from v where name = 'Jay') to (select from v where name = 'Amiga')\"}", + "{\"command\":\"create edge from (select from v where name = 'Jay') to (select from" + + " v where name = 'Amiga')\"}", CONTENT.TEXT) .setUserName("admin") .setUserPassword("admin") diff --git a/graphdb/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpGraphTest.java b/graphdb/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpGraphTest.java index 8582b1be0e2..ea3fb737f92 100755 --- a/graphdb/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpGraphTest.java +++ b/graphdb/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpGraphTest.java @@ -41,7 +41,8 @@ public void updateWithEdges() throws IOException { script += "return $v1;"; String scriptPayload = - "{ \"operations\" : [{ \"type\" : \"script\", \"language\" : \"SQL\", \"script\" : \"%s\"}]}"; + "{ \"operations\" : [{ \"type\" : \"script\", \"language\" : \"SQL\", \"script\" :" + + " \"%s\"}]}"; HttpResponse response = post("batch/" + getDatabaseName() + "/sql/") diff --git a/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/BatchRemoteResultSetTest.java b/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/BatchRemoteResultSetTest.java index 5c34a523b51..9d93c137df1 100755 --- a/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/BatchRemoteResultSetTest.java +++ b/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/BatchRemoteResultSetTest.java @@ -33,9 +33,16 @@ public class BatchRemoteResultSetTest { @Before public void before() - throws ClassNotFoundException, MalformedObjectNameException, InstanceAlreadyExistsException, - NotCompliantMBeanException, MBeanRegistrationException, InvocationTargetException, - NoSuchMethodException, InstantiationException, IOException, IllegalAccessException { + throws ClassNotFoundException, + MalformedObjectNameException, + InstanceAlreadyExistsException, + NotCompliantMBeanException, + MBeanRegistrationException, + InvocationTargetException, + NoSuchMethodException, + InstantiationException, + IOException, + IllegalAccessException { final String buildDirectory = System.getProperty("buildDirectory", "."); serverHome = buildDirectory + File.separator + BaseHttpTest.class.getSimpleName(); @@ -62,8 +69,10 @@ public void before() public void runBatchQuery() { String batchQuery = - "begin; LET t0 = CREATE VERTEX V set mame=\"a\" ;\n LET t1 = CREATE VERTEX V set name=\"b\" ;\n" - + "LET t2 = CREATE EDGE E FROM $t0 TO $t1 ;\n commit retry 100\n" + "begin; LET t0 = CREATE VERTEX V set mame=\"a\" ;\n" + + " LET t1 = CREATE VERTEX V set name=\"b\" ;\n" + + "LET t2 = CREATE EDGE E FROM $t0 TO $t1 ;\n" + + " commit retry 100\n" + "return [$t0,$t1,$t2]"; OrientGraph graph = diff --git a/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/DirtyTrackingTreeRidBagRemoteTest.java b/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/DirtyTrackingTreeRidBagRemoteTest.java index 93290b42f71..7339acdcfec 100755 --- a/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/DirtyTrackingTreeRidBagRemoteTest.java +++ b/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/DirtyTrackingTreeRidBagRemoteTest.java @@ -31,9 +31,16 @@ public class DirtyTrackingTreeRidBagRemoteTest { @Before public void before() - throws ClassNotFoundException, MalformedObjectNameException, InstanceAlreadyExistsException, - NotCompliantMBeanException, MBeanRegistrationException, InvocationTargetException, - NoSuchMethodException, InstantiationException, IOException, IllegalAccessException { + throws ClassNotFoundException, + MalformedObjectNameException, + InstanceAlreadyExistsException, + NotCompliantMBeanException, + MBeanRegistrationException, + InvocationTargetException, + NoSuchMethodException, + InstantiationException, + IOException, + IllegalAccessException { final String buildDirectory = System.getProperty("buildDirectory", "."); serverHome = buildDirectory + "/" + DirtyTrackingTreeRidBagRemoteTest.class.getSimpleName(); deleteDirectory(new File(serverHome)); diff --git a/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/OrientBenchmarkTestSuite.java b/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/OrientBenchmarkTestSuite.java index 61e8a9eca09..7bebfa77b10 100644 --- a/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/OrientBenchmarkTestSuite.java +++ b/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/OrientBenchmarkTestSuite.java @@ -13,7 +13,9 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -/** @author Marko A. Rodriguez (http://markorodriguez.com) */ +/** + * @author Marko A. Rodriguez (http://markorodriguez.com) + */ @RunWith(JUnit4.class) public class OrientBenchmarkTestSuite extends TestSuite { diff --git a/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/OrientGraphFactoryTest.java b/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/OrientGraphFactoryTest.java index 1c894489b67..00365ff76bb 100755 --- a/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/OrientGraphFactoryTest.java +++ b/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/OrientGraphFactoryTest.java @@ -13,7 +13,9 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -/** @author Luca Garulli (l.garulli--(at)--orientdb.com) (http://orientdb.com) */ +/** + * @author Luca Garulli (l.garulli--(at)--orientdb.com) (http://orientdb.com) + */ @RunWith(JUnit4.class) public class OrientGraphFactoryTest { diff --git a/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/OrientGraphNoTxTest.java b/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/OrientGraphNoTxTest.java index c2b4d7b64f5..d884f58e9cf 100755 --- a/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/OrientGraphNoTxTest.java +++ b/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/OrientGraphNoTxTest.java @@ -22,7 +22,9 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -/** @author Marko A. Rodriguez (http://markorodriguez.com) */ +/** + * @author Marko A. Rodriguez (http://markorodriguez.com) + */ @RunWith(JUnit4.class) public class OrientGraphNoTxTest extends GraphTest { private Map currentGraphs = new HashMap(); diff --git a/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/OrientGraphSpecificTestSuite.java b/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/OrientGraphSpecificTestSuite.java index f335dff3529..d181844e355 100644 --- a/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/OrientGraphSpecificTestSuite.java +++ b/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/OrientGraphSpecificTestSuite.java @@ -14,7 +14,9 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -/** @author Stephen Mallette (http://stephen.genoprime.com) */ +/** + * @author Stephen Mallette (http://stephen.genoprime.com) + */ @RunWith(JUnit4.class) public class OrientGraphSpecificTestSuite extends TestSuite { public OrientGraphSpecificTestSuite() { diff --git a/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/SelectProjectionVertexRemoteTest.java b/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/SelectProjectionVertexRemoteTest.java index 2b479c9c0d9..327b9d3af0b 100755 --- a/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/SelectProjectionVertexRemoteTest.java +++ b/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/SelectProjectionVertexRemoteTest.java @@ -26,9 +26,16 @@ public class SelectProjectionVertexRemoteTest { @Before public void before() - throws ClassNotFoundException, MalformedObjectNameException, InstanceAlreadyExistsException, - NotCompliantMBeanException, MBeanRegistrationException, InvocationTargetException, - NoSuchMethodException, InstantiationException, IOException, IllegalAccessException { + throws ClassNotFoundException, + MalformedObjectNameException, + InstanceAlreadyExistsException, + NotCompliantMBeanException, + MBeanRegistrationException, + InvocationTargetException, + NoSuchMethodException, + InstantiationException, + IOException, + IllegalAccessException { server = new OServer(false); server.startup( OrientGraphRemoteTest.class.getResourceAsStream("/embedded-server-config-single-run.xml")); @@ -69,7 +76,8 @@ public void test() { graph.commit(); String query = - "SELECT $res as val LET $res = (SELECT @rid AS refId, out('AtoB') AS vertices FROM VertA) FETCHPLAN val:2"; + "SELECT $res as val LET $res = (SELECT @rid AS refId, out('AtoB') AS vertices FROM VertA)" + + " FETCHPLAN val:2"; Iterable results = graph.command(new OCommandSQL(query)).execute(); final Iterator iterator = results.iterator(); diff --git a/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/SelectProjectionVertexTest.java b/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/SelectProjectionVertexTest.java index b6f9599313b..a8a76fe0b4e 100644 --- a/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/SelectProjectionVertexTest.java +++ b/graphdb/src/test/java/com/tinkerpop/blueprints/impls/orient/SelectProjectionVertexTest.java @@ -28,7 +28,8 @@ public void test() { graph.commit(); String query = - "SELECT $res as val LET $res = (SELECT @rid AS refId, out('AtoB') AS vertices FROM VertA) FETCHPLAN val:2"; + "SELECT $res as val LET $res = (SELECT @rid AS refId, out('AtoB') AS vertices FROM VertA)" + + " FETCHPLAN val:2"; Iterable results = graph.command(new OCommandSQL(query)).execute(); final Iterator iterator = results.iterator(); diff --git a/jdbc/pom.xml b/jdbc/pom.xml index d36144c36de..3e1a8425592 100755 --- a/jdbc/pom.xml +++ b/jdbc/pom.xml @@ -26,6 +26,11 @@ ../pom.xml + + + 2023-01-01T00:00:00Z + + OrientDB JDBC Driver orientdb-jdbc diff --git a/jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientDbCreationHelper.java b/jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientDbCreationHelper.java index 937d494e469..22583dcceb1 100644 --- a/jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientDbCreationHelper.java +++ b/jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientDbCreationHelper.java @@ -66,13 +66,18 @@ public static ODocument createItem(int id, ODocument doc) { doc.field("stringKey", itemKey); doc.field("intKey", id); String contents = - "OrientDB is a deeply scalable Document-Graph DBMS with the flexibility of the Document databases and the power to manage links of the Graph databases. " - + "It can work in schema-less mode, schema-full or a mix of both. Supports advanced features such as ACID Transactions, Fast Indexes, Native and SQL queries." - + " It imports and exports documents in JSON." - + " Graphs of hundreads of linked documents can be retrieved all in memory in few milliseconds without executing costly JOIN such as the Relational DBMSs do. " - + "OrientDB uses a new indexing algorithm called MVRB-Tree, derived from the Red-Black Tree and from the B+Tree with benefits of both: fast insertion and ultra fast lookup. " - + "The transactional engine can run in distributed systems supporting up to 9.223.372.036 Billions of records for the maximum capacity of 19.807.040.628.566.084 Terabytes of data distributed on multiple disks in multiple nodes. " - + "OrientDB is FREE for any use. Open Source License Apache 2.0. "; + "OrientDB is a deeply scalable Document-Graph DBMS with the flexibility of the Document" + + " databases and the power to manage links of the Graph databases. It can work in" + + " schema-less mode, schema-full or a mix of both. Supports advanced features such as" + + " ACID Transactions, Fast Indexes, Native and SQL queries. It imports and exports" + + " documents in JSON. Graphs of hundreads of linked documents can be retrieved all in" + + " memory in few milliseconds without executing costly JOIN such as the Relational" + + " DBMSs do. OrientDB uses a new indexing algorithm called MVRB-Tree, derived from the" + + " Red-Black Tree and from the B+Tree with benefits of both: fast insertion and ultra" + + " fast lookup. The transactional engine can run in distributed systems supporting up" + + " to 9.223.372.036 Billions of records for the maximum capacity of" + + " 19.807.040.628.566.084 Terabytes of data distributed on multiple disks in multiple" + + " nodes. OrientDB is FREE for any use. Open Source License Apache 2.0. "; doc.field("text", contents); doc.field("title", "orientDB"); doc.field("score", BigDecimal.valueOf(contents.length() / id)); diff --git a/jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientJdbcBlobTest.java b/jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientJdbcBlobTest.java index a88b9a45f28..c0197f81717 100644 --- a/jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientJdbcBlobTest.java +++ b/jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientJdbcBlobTest.java @@ -137,7 +137,8 @@ private String calculateMD5checksum(InputStream fileStream) try { fileStream = new DigestInputStream(fileStream, md); - while (fileStream.read() != -1) ; + while (fileStream.read() != -1) + ; } finally { try { fileStream.close(); diff --git a/jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientJdbcIssuesTest.java b/jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientJdbcIssuesTest.java index 0c9ef0ad805..4ffe4581620 100644 --- a/jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientJdbcIssuesTest.java +++ b/jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientJdbcIssuesTest.java @@ -17,14 +17,16 @@ public void shouldMapNullValues_ph8555() throws Exception { // + "CREATE PROPERTY Demo.lastName STRING\n" // + "CREATE PROPERTY Demo.address STRING\n" // + "CREATE PROPERTY Demo.amount INTEGER\n" - + "INSERT INTO Demo(firstName, lastName, address, amount) VALUES (\"John\", \"John\", \"Street1\", 1234);\n" + + "INSERT INTO Demo(firstName, lastName, address, amount) VALUES (\"John\", \"John\"," + + " \"Street1\", 1234);\n" + "INSERT INTO Demo(firstName, lastName, amount) VALUES (\"Lars\", \"Lar\", 2232);\n" + "INSERT INTO Demo(firstName, amount) VALUES (\"Lars\", 2232);"; Statement stmt = conn.createStatement(); stmt.addBatch("CREATE CLASS Demo;"); stmt.addBatch( - "INSERT INTO Demo(firstName, lastName, address, amount) VALUES (\"John\", \"John\", \"Street1\", 1234);"); + "INSERT INTO Demo(firstName, lastName, address, amount) VALUES (\"John\", \"John\"," + + " \"Street1\", 1234);"); stmt.addBatch( "INSERT INTO Demo(firstName, lastName, amount) VALUES (\"Lars\", \"Lar\", 2232);"); stmt.addBatch("INSERT INTO Demo(firstName, amount) VALUES (\"Lars\", 2232);"); diff --git a/jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientJdbcResultSetTest.java b/jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientJdbcResultSetTest.java index 6b65f81dbb5..e07868ea48e 100644 --- a/jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientJdbcResultSetTest.java +++ b/jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientJdbcResultSetTest.java @@ -105,7 +105,8 @@ public void shouldReadRowWithNullValue() throws Exception { Statement stmt = conn.createStatement(); stmt.execute( - "INSERT INTO Article(uuid, date, title, content) VALUES (123456, null, 'title', 'the content')"); + "INSERT INTO Article(uuid, date, title, content) VALUES (123456, null, 'title', 'the" + + " content')"); stmt.close(); diff --git a/jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientJdbcStatementDMLtest.java b/jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientJdbcStatementDMLtest.java index 91146e2358f..795010e7990 100644 --- a/jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientJdbcStatementDMLtest.java +++ b/jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientJdbcStatementDMLtest.java @@ -37,7 +37,8 @@ public void shouldInsertANewItem() throws Exception { Statement stmt = conn.createStatement(); int updated = stmt.executeUpdate( - "INSERT into Item (stringKey, intKey, text, length, date) values ('100','100','dummy text','10','" + "INSERT into Item (stringKey, intKey, text, length, date) values ('100','100','dummy" + + " text','10','" + date.toString() + "')"); diff --git a/lucene/pom.xml b/lucene/pom.xml index 0e86b3ca87f..cdc3b2c0017 100755 --- a/lucene/pom.xml +++ b/lucene/pom.xml @@ -36,6 +36,8 @@ 7.7.3 UTF-8 + + 2023-01-01T00:00:00Z diff --git a/lucene/src/main/java/com/orientechnologies/lucene/builder/OLuceneQueryBuilder.java b/lucene/src/main/java/com/orientechnologies/lucene/builder/OLuceneQueryBuilder.java index c689d23688a..0e02141e01b 100755 --- a/lucene/src/main/java/com/orientechnologies/lucene/builder/OLuceneQueryBuilder.java +++ b/lucene/src/main/java/com/orientechnologies/lucene/builder/OLuceneQueryBuilder.java @@ -116,7 +116,9 @@ private Query getQuery( throws ParseException { final Map boost = Optional.ofNullable(metadata.>getProperty("boost")) - .orElse(new HashMap<>()).entrySet().stream() + .orElse(new HashMap<>()) + .entrySet() + .stream() .collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue().floatValue())); final Analyzer analyzer = Optional.ofNullable(metadata.getProperty("customAnalysis")) diff --git a/lucene/src/main/java/com/orientechnologies/lucene/engine/OLuceneDirectory.java b/lucene/src/main/java/com/orientechnologies/lucene/engine/OLuceneDirectory.java index c95f5f0ce5c..4baf10db915 100644 --- a/lucene/src/main/java/com/orientechnologies/lucene/engine/OLuceneDirectory.java +++ b/lucene/src/main/java/com/orientechnologies/lucene/engine/OLuceneDirectory.java @@ -17,7 +17,9 @@ import org.apache.lucene.store.Directory; -/** @author mdjurovi */ +/** + * @author mdjurovi + */ public class OLuceneDirectory { private final Directory dir; private final String path; diff --git a/lucene/src/main/java/com/orientechnologies/spatial/OLuceneMockSpatialSerializer.java b/lucene/src/main/java/com/orientechnologies/spatial/OLuceneMockSpatialSerializer.java index 360a5ceeeee..7d3b8b9a656 100644 --- a/lucene/src/main/java/com/orientechnologies/spatial/OLuceneMockSpatialSerializer.java +++ b/lucene/src/main/java/com/orientechnologies/spatial/OLuceneMockSpatialSerializer.java @@ -87,11 +87,21 @@ public ODocument deserializeFromByteBufferObject(ByteBuffer buffer) { return null; } + @Override + public ODocument deserializeFromByteBufferObject(int offset, ByteBuffer buffer) { + return null; + } + @Override public int getObjectSizeInByteBuffer(ByteBuffer buffer) { return 0; } + @Override + public int getObjectSizeInByteBuffer(int offset, ByteBuffer buffer) { + return 0; + } + @Override public ODocument deserializeFromByteBufferObject( ByteBuffer buffer, OWALChanges walChanges, int offset) { diff --git a/lucene/src/main/java/com/orientechnologies/spatial/operator/OLuceneNearOperator.java b/lucene/src/main/java/com/orientechnologies/spatial/operator/OLuceneNearOperator.java index a284dc54f69..dd8e092268c 100644 --- a/lucene/src/main/java/com/orientechnologies/spatial/operator/OLuceneNearOperator.java +++ b/lucene/src/main/java/com/orientechnologies/spatial/operator/OLuceneNearOperator.java @@ -166,7 +166,8 @@ public ORID getEndRidRange(Object iLeft, Object iRight) { @Override public String getSyntax() { - return " NEAR[( [, [,]] )] ( )"; + return " NEAR[( [, [,]] )] ( " + + " )"; } @Override diff --git a/lucene/src/test/java/com/orientechnologies/lucene/benchmark/FulltextIndexFunctionBenchmark.java b/lucene/src/test/java/com/orientechnologies/lucene/benchmark/FulltextIndexFunctionBenchmark.java index 389a45c7d62..d5b2c6919e1 100755 --- a/lucene/src/test/java/com/orientechnologies/lucene/benchmark/FulltextIndexFunctionBenchmark.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/benchmark/FulltextIndexFunctionBenchmark.java @@ -62,7 +62,8 @@ public void setup() { db.command("create index Song.title on Song (title) FULLTEXT ENGINE LUCENE "); db.command("create index Song.author on Song (author) FULLTEXT ENGINE LUCENE "); db.command( - "create index Song.lyrics_description on Song (lyrics,description) FULLTEXT ENGINE LUCENE "); + "create index Song.lyrics_description on Song (lyrics,description) FULLTEXT ENGINE LUCENE" + + " "); } private void setupDatabase() { @@ -114,7 +115,8 @@ public void searchOnSingleField() { public void searhOnTwoFieldsInOR() { final OResultSet resultSet = db.query( - "SELECT from Song where SEARCH_FIELDS(['title'], 'BELIEVE') = true OR SEARCH_FIELDS(['author'], 'Bob') = true "); + "SELECT from Song where SEARCH_FIELDS(['title'], 'BELIEVE') = true OR" + + " SEARCH_FIELDS(['author'], 'Bob') = true "); resultSet.close(); } @@ -122,7 +124,8 @@ public void searhOnTwoFieldsInOR() { public void searhOnTwoFieldsInAND() throws Exception { final OResultSet resultSet = db.query( - "SELECT from Song where SEARCH_FIELDS(['title'], 'tambourine') = true AND SEARCH_FIELDS(['author'], 'Bob') = true "); + "SELECT from Song where SEARCH_FIELDS(['title'], 'tambourine') = true AND" + + " SEARCH_FIELDS(['author'], 'Bob') = true "); resultSet.close(); } } diff --git a/lucene/src/test/java/com/orientechnologies/lucene/functions/OLuceneSearchMoreLikeThisFunctionTest.java b/lucene/src/test/java/com/orientechnologies/lucene/functions/OLuceneSearchMoreLikeThisFunctionTest.java index f415c350b29..6756934ac7b 100755 --- a/lucene/src/test/java/com/orientechnologies/lucene/functions/OLuceneSearchMoreLikeThisFunctionTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/functions/OLuceneSearchMoreLikeThisFunctionTest.java @@ -126,7 +126,8 @@ public void shouldSearchMoreLikeThisWithInnerQuery() throws Exception { try (OResultSet resultSet = db.query( - "SELECT from Song let $a=(SELECT @rid FROM Song WHERE author = 'Hunter') where SEARCH_More( $a, { 'minTermFreq':1, 'minDocFreq':1} ) = true")) { + "SELECT from Song let $a=(SELECT @rid FROM Song WHERE author = 'Hunter') where" + + " SEARCH_More( $a, { 'minTermFreq':1, 'minDocFreq':1} ) = true")) { assertThat(resultSet).hasSize(229); } } diff --git a/lucene/src/test/java/com/orientechnologies/lucene/functions/OLuceneSearchOnClassFunctionTest.java b/lucene/src/test/java/com/orientechnologies/lucene/functions/OLuceneSearchOnClassFunctionTest.java index 1f7aa394bb7..c81e1dfc25f 100755 --- a/lucene/src/test/java/com/orientechnologies/lucene/functions/OLuceneSearchOnClassFunctionTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/functions/OLuceneSearchOnClassFunctionTest.java @@ -48,7 +48,8 @@ public void shouldSearchInOr() throws Exception { OResultSet resultSet = db.query( - "SELECT from Song where SEARCH_CLASS('BELIEVE') = true OR SEARCH_CLASS('GOODNIGHT') = true "); + "SELECT from Song where SEARCH_CLASS('BELIEVE') = true OR SEARCH_CLASS('GOODNIGHT') =" + + " true "); assertThat(resultSet).hasSize(5); resultSet.close(); @@ -59,7 +60,8 @@ public void shouldSearchInAnd() throws Exception { OResultSet resultSet = db.query( - "SELECT from Song where SEARCH_CLASS('GOODNIGHT') = true AND SEARCH_CLASS( 'Irene', {'allowLeadingWildcard': true}) = true "); + "SELECT from Song where SEARCH_CLASS('GOODNIGHT') = true AND SEARCH_CLASS( 'Irene'," + + " {'allowLeadingWildcard': true}) = true "); assertThat(resultSet).hasSize(1); resultSet.close(); @@ -69,7 +71,8 @@ public void shouldThrowExceptionWithWrongClass() throws Exception { OResultSet resultSet = db.query( - "SELECT from Author where SEARCH_CLASS('(description:happiness) (lyrics:sad) ') = true "); + "SELECT from Author where SEARCH_CLASS('(description:happiness) (lyrics:sad) ') = true" + + " "); resultSet.close(); } @@ -88,8 +91,8 @@ public void shouldHighlightTitle() throws Exception { OResultSet resultSet = db.query( - "SELECT title, $title_hl from Song where SEARCH_CLASS('believe', {" - + "highlight: { fields: ['title'], 'start': '', 'end': '' } }) = true "); + "SELECT title, $title_hl from Song where SEARCH_CLASS('believe', {highlight: { fields:" + + " ['title'], 'start': '', 'end': '' } }) = true "); resultSet.stream() .forEach( @@ -111,8 +114,9 @@ public void shouldHighlightWithNullValues() throws Exception { OResultSet resultSet = db.query( - "SELECT title, $title_hl,description, $description_hl from Song where SEARCH_CLASS('shouldHighlightWithNullValues', {" - + "highlight: { fields: ['title','description'], 'start': '', 'end': '' } }) = true "); + "SELECT title, $title_hl,description, $description_hl from Song where" + + " SEARCH_CLASS('shouldHighlightWithNullValues', {highlight: { fields:" + + " ['title','description'], 'start': '', 'end': '' } }) = true "); resultSet.stream() .forEach( diff --git a/lucene/src/test/java/com/orientechnologies/lucene/functions/OLuceneSearchOnFieldsFunctionTest.java b/lucene/src/test/java/com/orientechnologies/lucene/functions/OLuceneSearchOnFieldsFunctionTest.java index a86178da581..487b9016983 100755 --- a/lucene/src/test/java/com/orientechnologies/lucene/functions/OLuceneSearchOnFieldsFunctionTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/functions/OLuceneSearchOnFieldsFunctionTest.java @@ -23,7 +23,8 @@ public void setUp() throws Exception { db.command("create index Song.title on Song (title) FULLTEXT ENGINE LUCENE "); db.command("create index Song.author on Song (author) FULLTEXT ENGINE LUCENE "); db.command( - "create index Song.lyrics_description on Song (lyrics,description) FULLTEXT ENGINE LUCENE "); + "create index Song.lyrics_description on Song (lyrics,description) FULLTEXT ENGINE LUCENE" + + " "); } @Test @@ -39,7 +40,8 @@ public void shouldSearchOnSingleFieldWithLeadingWildcard() throws Exception { // TODO: metadata still not used final OResultSet resultSet = db.query( - "SELECT from Song where SEARCH_FIELDS(['title'], '*EVE*', {'allowLeadingWildcard': true}) = true"); + "SELECT from Song where SEARCH_FIELDS(['title'], '*EVE*', {'allowLeadingWildcard':" + + " true}) = true"); assertThat(resultSet).hasSize(14); resultSet.close(); } @@ -48,7 +50,8 @@ public void shouldSearchOnSingleFieldWithLeadingWildcard() throws Exception { public void shouldSearhOnTwoFieldsInOR() throws Exception { final OResultSet resultSet = db.query( - "SELECT from Song where SEARCH_FIELDS(['title'], 'BELIEVE') = true OR SEARCH_FIELDS(['author'], 'Bob') = true "); + "SELECT from Song where SEARCH_FIELDS(['title'], 'BELIEVE') = true OR" + + " SEARCH_FIELDS(['author'], 'Bob') = true "); assertThat(resultSet).hasSize(41); resultSet.close(); } @@ -57,7 +60,8 @@ public void shouldSearhOnTwoFieldsInOR() throws Exception { public void shouldSearchOnTwoFieldsInAND() throws Exception { final OResultSet resultSet = db.query( - "SELECT from Song where SEARCH_FIELDS(['title'], 'tambourine') = true AND SEARCH_FIELDS(['author'], 'Bob') = true "); + "SELECT from Song where SEARCH_FIELDS(['title'], 'tambourine') = true AND" + + " SEARCH_FIELDS(['author'], 'Bob') = true "); assertThat(resultSet).hasSize(1); resultSet.close(); } @@ -66,7 +70,8 @@ public void shouldSearchOnTwoFieldsInAND() throws Exception { public void shouldSearhOnTwoFieldsWithLeadingWildcardInAND() throws Exception { final OResultSet resultSet = db.query( - "SELECT from Song where SEARCH_FIELDS(['title'], 'tambourine') = true AND SEARCH_FIELDS(['author'], 'Bob', {'allowLeadingWildcard': true}) = true "); + "SELECT from Song where SEARCH_FIELDS(['title'], 'tambourine') = true AND" + + " SEARCH_FIELDS(['author'], 'Bob', {'allowLeadingWildcard': true}) = true "); assertThat(resultSet).hasSize(1); resultSet.close(); } @@ -75,20 +80,23 @@ public void shouldSearhOnTwoFieldsWithLeadingWildcardInAND() throws Exception { public void shouldSearchOnMultiFieldIndex() throws Exception { OResultSet resultSet = db.query( - "SELECT from Song where SEARCH_FIELDS(['lyrics','description'], '(description:happiness) (lyrics:sad) ') = true "); + "SELECT from Song where SEARCH_FIELDS(['lyrics','description']," + + " '(description:happiness) (lyrics:sad) ') = true "); assertThat(resultSet).hasSize(2); resultSet.close(); resultSet = db.query( - "SELECT from Song where SEARCH_FIELDS(['description','lyrics'], '(description:happiness) (lyrics:sad) ') = true "); + "SELECT from Song where SEARCH_FIELDS(['description','lyrics']," + + " '(description:happiness) (lyrics:sad) ') = true "); assertThat(resultSet).hasSize(2); resultSet.close(); resultSet = db.query( - "SELECT from Song where SEARCH_FIELDS(['description'], '(description:happiness) (lyrics:sad) ') = true "); + "SELECT from Song where SEARCH_FIELDS(['description'], '(description:happiness)" + + " (lyrics:sad) ') = true "); assertThat(resultSet).hasSize(2); resultSet.close(); } @@ -96,7 +104,8 @@ public void shouldSearchOnMultiFieldIndex() throws Exception { @Test(expected = OCommandExecutionException.class) public void shouldFailWithWrongFieldName() throws Exception { db.query( - "SELECT from Song where SEARCH_FIELDS(['wrongName'], '(description:happiness) (lyrics:sad) ') = true "); + "SELECT from Song where SEARCH_FIELDS(['wrongName'], '(description:happiness) (lyrics:sad) " + + " ') = true "); } @Test diff --git a/lucene/src/test/java/com/orientechnologies/lucene/functions/OLuceneSearchOnIndexFunctionTest.java b/lucene/src/test/java/com/orientechnologies/lucene/functions/OLuceneSearchOnIndexFunctionTest.java index d04e051cceb..443a1c1d9bb 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/functions/OLuceneSearchOnIndexFunctionTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/functions/OLuceneSearchOnIndexFunctionTest.java @@ -26,7 +26,8 @@ public void setUp() throws Exception { db.command("create index Song.author on Song (author) FULLTEXT ENGINE LUCENE "); db.command("create index Author.name on Author (name) FULLTEXT ENGINE LUCENE "); db.command( - "create index Song.lyrics_description on Song (lyrics,description) FULLTEXT ENGINE LUCENE "); + "create index Song.lyrics_description on Song (lyrics,description) FULLTEXT ENGINE LUCENE" + + " "); } @Test @@ -70,7 +71,8 @@ public void shouldSearchOnSingleIndexWithLeadingWildcard() throws Exception { // TODO: metadata still not used OResultSet resultSet = db.query( - "SELECT from Song where SEARCH_INDEX('Song.title', '*EVE*', {'allowLeadingWildcard': true}) = true"); + "SELECT from Song where SEARCH_INDEX('Song.title', '*EVE*', {'allowLeadingWildcard':" + + " true}) = true"); // resultSet.getExecutionPlan().ifPresent(x -> System.out.println(x.prettyPrint(0, 2))); assertThat(resultSet).hasSize(14); @@ -83,7 +85,8 @@ public void shouldSearchOnTwoIndexesInOR() throws Exception { OResultSet resultSet = db.query( - "SELECT from Song where SEARCH_INDEX('Song.title', 'BELIEVE') = true OR SEARCH_INDEX('Song.author', 'Bob') = true "); + "SELECT from Song where SEARCH_INDEX('Song.title', 'BELIEVE') = true OR" + + " SEARCH_INDEX('Song.author', 'Bob') = true "); assertThat(resultSet).hasSize(41); resultSet.close(); @@ -94,7 +97,8 @@ public void shouldSearchOnTwoIndexesInAND() throws Exception { OResultSet resultSet = db.query( - "SELECT from Song where SEARCH_INDEX('Song.title', 'tambourine') = true AND SEARCH_INDEX('Song.author', 'Bob') = true "); + "SELECT from Song where SEARCH_INDEX('Song.title', 'tambourine') = true AND" + + " SEARCH_INDEX('Song.author', 'Bob') = true "); assertThat(resultSet).hasSize(1); resultSet.close(); @@ -105,7 +109,8 @@ public void shouldSearchOnTwoIndexesWithLeadingWildcardInAND() throws Exception OResultSet resultSet = db.query( - "SELECT from Song where SEARCH_INDEX('Song.title', 'tambourine') = true AND SEARCH_INDEX('Song.author', 'Bob', {'allowLeadingWildcard': true}) = true "); + "SELECT from Song where SEARCH_INDEX('Song.title', 'tambourine') = true AND" + + " SEARCH_INDEX('Song.author', 'Bob', {'allowLeadingWildcard': true}) = true "); assertThat(resultSet).hasSize(1); resultSet.close(); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/index/OLuceneAllIndexTest.java b/lucene/src/test/java/com/orientechnologies/lucene/index/OLuceneAllIndexTest.java index 2e88e8ea737..cc1e3e5a1a4 100755 --- a/lucene/src/test/java/com/orientechnologies/lucene/index/OLuceneAllIndexTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/index/OLuceneAllIndexTest.java @@ -31,19 +31,22 @@ public void init() throws IOException { // three separate indeexs, one result db.command( - "create index Song.title on Song (title) FULLTEXT ENGINE LUCENE METADATA {\"index_analyzer\":\"" + "create index Song.title on Song (title) FULLTEXT ENGINE LUCENE METADATA" + + " {\"index_analyzer\":\"" + StandardAnalyzer.class.getName() + "\"}") .close(); db.command( - "create index Song.author on Song (author) FULLTEXT ENGINE LUCENE METADATA {\"index_analyzer\":\"" + "create index Song.author on Song (author) FULLTEXT ENGINE LUCENE METADATA" + + " {\"index_analyzer\":\"" + StandardAnalyzer.class.getName() + "\"}") .close(); db.command( - "create index Song.lyrics on Song (lyrics) FULLTEXT ENGINE LUCENE METADATA {\"index_analyzer\":\"" + "create index Song.lyrics on Song (lyrics) FULLTEXT ENGINE LUCENE METADATA" + + " {\"index_analyzer\":\"" + EnglishAnalyzer.class.getName() + "\"}") .close(); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/integration/LuceneCreateIndexIntegrationTest.java b/lucene/src/test/java/com/orientechnologies/lucene/integration/LuceneCreateIndexIntegrationTest.java index e94ed8090ef..9c4e0fa425e 100755 --- a/lucene/src/test/java/com/orientechnologies/lucene/integration/LuceneCreateIndexIntegrationTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/integration/LuceneCreateIndexIntegrationTest.java @@ -24,7 +24,8 @@ public void before() throws Exception { remote = new OrientDB("remote:localhost", "root", "test", OrientDBConfig.defaultConfig()); remote.execute( - "create database LuceneCreateIndexIntegrationTest plocal users(admin identified by 'admin' role admin) "); + "create database LuceneCreateIndexIntegrationTest plocal users(admin identified by 'admin'" + + " role admin) "); final ODatabaseSession session = remote.open("LuceneCreateIndexIntegrationTest", "admin", "admin"); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/integration/LuceneDropIndexIntegrationTest.java b/lucene/src/test/java/com/orientechnologies/lucene/integration/LuceneDropIndexIntegrationTest.java index 30828c31a23..6570ac6975d 100755 --- a/lucene/src/test/java/com/orientechnologies/lucene/integration/LuceneDropIndexIntegrationTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/integration/LuceneDropIndexIntegrationTest.java @@ -32,7 +32,8 @@ public void before() throws Exception { final OrientDB remote = new OrientDB("remote:localhost", "root", "test", OrientDBConfig.defaultConfig()); remote.execute( - "create database LuceneDropIndexIntegrationTest plocal users(admin identified by 'admin' role admin)"); + "create database LuceneDropIndexIntegrationTest plocal users(admin identified by 'admin'" + + " role admin)"); ODatabaseSession session = remote.open("LuceneDropIndexIntegrationTest", "admin", "admin"); session.command("create class Person"); @@ -75,8 +76,12 @@ public void testDropDatabase() throws IOException { @After public void after() - throws InstantiationException, IllegalAccessException, ClassNotFoundException, - NoSuchMethodException, IOException, InvocationTargetException { + throws InstantiationException, + IllegalAccessException, + ClassNotFoundException, + NoSuchMethodException, + IOException, + InvocationTargetException { server0.shutdown(); server1.shutdown(); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/integration/OLuceneIndexCrashRestoreIT.java b/lucene/src/test/java/com/orientechnologies/lucene/integration/OLuceneIndexCrashRestoreIT.java index e37e1895fdf..7456262de41 100755 --- a/lucene/src/test/java/com/orientechnologies/lucene/integration/OLuceneIndexCrashRestoreIT.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/integration/OLuceneIndexCrashRestoreIT.java @@ -254,9 +254,13 @@ private void createSchema(ODatabasePool pool) { db.command("Create property Person.name STRING"); db.command("Create property Person.surname STRING"); db.command( - "Create index Person.name on Person(name) FULLTEXT ENGINE LUCENE METADATA {'default':'org.apache.lucene.analysis.core.KeywordAnalyzer', 'unknownKey':'unknownValue'}"); + "Create index Person.name on Person(name) FULLTEXT ENGINE LUCENE METADATA" + + " {'default':'org.apache.lucene.analysis.core.KeywordAnalyzer'," + + " 'unknownKey':'unknownValue'}"); db.command( - "Create index Person.surname on Person(surname) FULLTEXT ENGINE LUCENE METADATA {'default':'org.apache.lucene.analysis.core.KeywordAnalyzer', 'unknownKey':'unknownValue'}"); + "Create index Person.surname on Person(surname) FULLTEXT ENGINE LUCENE METADATA" + + " {'default':'org.apache.lucene.analysis.core.KeywordAnalyzer'," + + " 'unknownKey':'unknownValue'}"); db.getMetadata().getIndexManagerInternal().reload(); System.out.println( diff --git a/lucene/src/test/java/com/orientechnologies/lucene/sandbox/LuceneSandboxTest.java b/lucene/src/test/java/com/orientechnologies/lucene/sandbox/LuceneSandboxTest.java index ffe9778974c..a988c0380e6 100755 --- a/lucene/src/test/java/com/orientechnologies/lucene/sandbox/LuceneSandboxTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/sandbox/LuceneSandboxTest.java @@ -19,9 +19,11 @@ public void setUp() throws Exception { db.command("CREATE CLASS CDR"); db.command("CREATE PROPERTY CDR.filename STRING"); db.command( - "INSERT into cdr(filename) values('MDCA10MCR201612291808.276388.eno.RRC.20161229183002.PROD_R4.eno.data') "); + "INSERT into cdr(filename)" + + " values('MDCA10MCR201612291808.276388.eno.RRC.20161229183002.PROD_R4.eno.data') "); db.command( - "INSERT into cdr(filename) values('MDCA20MCR201612291911.277904.eno.RRC.20161229193002.PROD_R4.eno.data') "); + "INSERT into cdr(filename)" + + " values('MDCA20MCR201612291911.277904.eno.RRC.20161229193002.PROD_R4.eno.data') "); } @Test @@ -36,7 +38,8 @@ public void shouldFetchOneDocumentWithExactMatchOnLuceneIndexStandardAnalyzer() // exact match res = db.query( - "select from cdr WHERE filename LUCENE ' \"MDCA20MCR201612291911.277904.eno.RRC.20161229193002.PROD_R4.eno.data\" '"); + "select from cdr WHERE filename LUCENE '" + + " \"MDCA20MCR201612291911.277904.eno.RRC.20161229193002.PROD_R4.eno.data\" '"); Assertions.assertThat(res).hasSize(1); res.close(); @@ -51,7 +54,8 @@ public void shouldFetchOneDocumentWithExactMatchOnLuceneIndexStandardAnalyzer() public void shouldFetchOneDocumentWithExactMatchOnLuceneIndexKeyWordAnalyzer() throws Exception { db.command( - "CREATE INDEX cdr.filename ON cdr(filename) FULLTEXT ENGINE LUCENE metadata { 'allowLeadingWildcard': true}"); + "CREATE INDEX cdr.filename ON cdr(filename) FULLTEXT ENGINE LUCENE metadata {" + + " 'allowLeadingWildcard': true}"); // partial match OResultSet res = @@ -63,7 +67,9 @@ public void shouldFetchOneDocumentWithExactMatchOnLuceneIndexKeyWordAnalyzer() t // exact match res = db.query( - "select from cdr WHERE SEARCH_CLASS( ' \"MDCA20MCR201612291911.277904.eno.RRC.20161229193002.PROD_R4.eno.data\" ') = true"); + "select from cdr WHERE SEARCH_CLASS( '" + + " \"MDCA20MCR201612291911.277904.eno.RRC.20161229193002.PROD_R4.eno.data\" ') =" + + " true"); Assertions.assertThat(res).hasSize(1); res.close(); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneContextTest.java b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneContextTest.java index 87654b56d03..9f07d851323 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneContextTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneContextTest.java @@ -61,7 +61,8 @@ public void testContext() { docs = db.query( - "select *,$totalHits,$Song_title_totalHits from Song where [title] LUCENE \"(title:man)\" limit 1"); + "select *,$totalHits,$Song_title_totalHits from Song where [title] LUCENE" + + " \"(title:man)\" limit 1"); OResult doc = docs.next(); Assert.assertEquals(new Long(14), doc.getProperty("$totalHits")); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneCreateIndexTest.java b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneCreateIndexTest.java index b4e828c144e..32d747b9c1b 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneCreateIndexTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneCreateIndexTest.java @@ -36,12 +36,14 @@ public void loadAndTest() { db.execute("sql", getScriptFromStream(stream)).close(); db.command( - "create index Song.title on Song (title) FULLTEXT ENGINE LUCENE METADATA {\"analyzer\":\"" + "create index Song.title on Song (title) FULLTEXT ENGINE LUCENE METADATA" + + " {\"analyzer\":\"" + StandardAnalyzer.class.getName() + "\"}") .close(); db.command( - "create index Song.author on Song (author) FULLTEXT ENGINE LUCENE METADATA {\"analyzer\":\"" + "create index Song.author on Song (author) FULLTEXT ENGINE LUCENE METADATA" + + " {\"analyzer\":\"" + StandardAnalyzer.class.getName() + "\"}") .close(); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneDropClusterTest.java b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneDropClusterTest.java index 41503127fd3..5cb379a04f4 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneDropClusterTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneDropClusterTest.java @@ -37,12 +37,14 @@ public void shouldRemoveCluster() throws Exception { db.execute("sql", getScriptFromStream(stream)).close(); db.command( - "create index Song.title on Song (title) FULLTEXT ENGINE LUCENE METADATA {\"default\":\"" + "create index Song.title on Song (title) FULLTEXT ENGINE LUCENE METADATA" + + " {\"default\":\"" + StandardAnalyzer.class.getName() + "\"}") .close(); db.command( - "create index Song.author on Song (author) FULLTEXT ENGINE LUCENE METADATA {\"default\":\"" + "create index Song.author on Song (author) FULLTEXT ENGINE LUCENE METADATA" + + " {\"default\":\"" + StandardAnalyzer.class.getName() + "\"}") .close(); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneFacetTest.java b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneFacetTest.java index 5ce5cc3ea97..363d195dd4a 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneFacetTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneFacetTest.java @@ -42,7 +42,8 @@ public void init() { oClass.createProperty("category", OType.STRING); db.command( - "create index Item.name_category on Item (name,category) FULLTEXT ENGINE LUCENE METADATA { 'facetFields' : ['category']}") + "create index Item.name_category on Item (name,category) FULLTEXT ENGINE LUCENE" + + " METADATA { 'facetFields' : ['category']}") .close(); ODocument doc = new ODocument("Item"); @@ -104,7 +105,8 @@ public void baseFacetTest() { result = db .command( - "select *,$facet from Item where name lucene { 'q' : 'H*', 'drillDown' : 'category:Electronic' } limit 1 ") + "select *,$facet from Item where name lucene { 'q' : 'H*', 'drillDown' :" + + " 'category:Electronic' } limit 1 ") .stream() .map((o) -> o.toElement()) .collect(Collectors.toList()); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneInsertDeleteTest.java b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneInsertDeleteTest.java index 7374292271f..592de54a083 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneInsertDeleteTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneInsertDeleteTest.java @@ -89,7 +89,8 @@ public void testDeleteWithQueryOnClosedIndex() throws Exception { } db.command( - "create index Song.title on Song (title) FULLTEXT ENGINE LUCENE metadata {'closeAfterInterval':1000 , 'firstFlushAfter':1000 }") + "create index Song.title on Song (title) FULLTEXT ENGINE LUCENE metadata" + + " {'closeAfterInterval':1000 , 'firstFlushAfter':1000 }") .close(); OResultSet docs = db.query("select from Song where title lucene 'mountain'"); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneIssuesTest.java b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneIssuesTest.java index 501ae548ac1..720572abc03 100755 --- a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneIssuesTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneIssuesTest.java @@ -39,7 +39,8 @@ public void testGh_4880_moreIndexesOnProperty() throws Exception { db.query("SELECT from Song where title = 'BELIEVE IT OR NOT' ").close(); db.command( - "EXPLAIN SELECT from Song where author = 'Traditional' OR [title,author] LUCENE '(title:believe'") + "EXPLAIN SELECT from Song where author = 'Traditional' OR [title,author] LUCENE" + + " '(title:believe'") .close(); } diff --git a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneMixIndexTest.java b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneMixIndexTest.java index ac44bcca353..e57c9eed17b 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneMixIndexTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneMixIndexTest.java @@ -44,24 +44,28 @@ public void testMixQuery() { OResultSet docs = db.query( - "select * from Song where author = 'Hornsby' and [title,lyrics] LUCENE \"(title:mountain)\" "); + "select * from Song where author = 'Hornsby' and [title,lyrics] LUCENE" + + " \"(title:mountain)\" "); Assert.assertEquals(1, docs.stream().count()); docs = db.query( - "select * from Song where author = 'Hornsby' and [title,lyrics] LUCENE \"(title:mountain)\" "); + "select * from Song where author = 'Hornsby' and [title,lyrics] LUCENE" + + " \"(title:mountain)\" "); Assert.assertEquals(1, docs.stream().count()); docs = db.query( - "select * from Song where author = 'Hornsby' and [title,lyrics] LUCENE \"(title:ballad)\" "); + "select * from Song where author = 'Hornsby' and [title,lyrics] LUCENE" + + " \"(title:ballad)\" "); Assert.assertEquals(0, docs.stream().count()); docs = db.query( - "select * from Song where author = 'Hornsby' and [title,lyrics] LUCENE \"(title:ballad)\" "); + "select * from Song where author = 'Hornsby' and [title,lyrics] LUCENE" + + " \"(title:ballad)\" "); Assert.assertEquals(0, docs.stream().count()); } @@ -71,13 +75,15 @@ public void testMixCompositeQuery() { OResultSet docs = db.query( - "select * from Song where author = 'Hornsby' and [title,lyrics] LUCENE \"title:mountain\" "); + "select * from Song where author = 'Hornsby' and [title,lyrics] LUCENE" + + " \"title:mountain\" "); Assert.assertEquals(1, docs.stream().count()); docs = db.query( - "select * from Song where author = 'Hornsby' and [title,lyrics] LUCENE \"lyrics:happy\" "); + "select * from Song where author = 'Hornsby' and [title,lyrics] LUCENE \"lyrics:happy\"" + + " "); Assert.assertEquals(1, docs.stream().count()); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneMultiFieldTest.java b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneMultiFieldTest.java index 1ae2a4139b6..cb05491c5e0 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneMultiFieldTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneMultiFieldTest.java @@ -48,8 +48,8 @@ public void init() throws Exception { //noinspection deprecation db.command( - "create index Song.title_author on Song (title,author) FULLTEXT ENGINE LUCENE METADATA {" - + "\"title_index\":\"" + "create index Song.title_author on Song (title,author) FULLTEXT ENGINE LUCENE METADATA" + + " {\"title_index\":\"" + EnglishAnalyzer.class.getName() + "\" , " + "\"title_query\":\"" @@ -72,7 +72,8 @@ public void testSelectSingleDocumentWithAndOperator() { OResultSet docs = db.query( - "select * from Song where [title,author] LUCENE \"(title:mountain AND author:Fabbio)\""); + "select * from Song where [title,author] LUCENE \"(title:mountain AND" + + " author:Fabbio)\""); assertThat(docs).hasSize(1); } @@ -80,7 +81,8 @@ public void testSelectSingleDocumentWithAndOperator() { public void testSelectSingleDocumentWithAndOperatorNEwExec() { try (OResultSet docs = db.query( - "select * from Song where [title,author] LUCENE \"(title:mountain AND author:Fabbio)\"")) { + "select * from Song where [title,author] LUCENE \"(title:mountain AND" + + " author:Fabbio)\"")) { assertThat(docs.hasNext()).isTrue(); docs.next(); @@ -127,7 +129,8 @@ public void testSelectOnIndexWithIgnoreNullValuesToFalse() { + "create property Item.Title string;\n" + "create property Item.Summary string;\n" + "create property Item.Content string;\n" - + "create index Item.i_lucene on Item(Title, Summary, Content) fulltext engine lucene METADATA {ignoreNullValues:false};\n" + + "create index Item.i_lucene on Item(Title, Summary, Content) fulltext engine lucene" + + " METADATA {ignoreNullValues:false};\n" + "insert into Item set Title = 'wrong', content = 'not me please';\n" + "insert into Item set Title = 'test', content = 'this is a test';\n"; db.execute("sql", script).close(); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneQeuryParserTest.java b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneQeuryParserTest.java index 8f86e56a590..cdb5db9a1fa 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneQeuryParserTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneQeuryParserTest.java @@ -22,7 +22,8 @@ public void shouldSearchWithLeadingWildcard() { // enabling leading wildcard db.command( - "create index Song.title on Song (title) FULLTEXT ENGINE LUCENE metadata {\"allowLeadingWildcard\": true}") + "create index Song.title on Song (title) FULLTEXT ENGINE LUCENE metadata" + + " {\"allowLeadingWildcard\": true}") .close(); // querying with leading wildcard @@ -36,7 +37,8 @@ public void shouldSearchWithLowercaseExpandedTerms() { // enabling leading wildcard db.command( - "create index Song.author on Song (author) FULLTEXT ENGINE LUCENE metadata {\"default\": \"" + "create index Song.author on Song (author) FULLTEXT ENGINE LUCENE metadata" + + " {\"default\": \"" + KeywordAnalyzer.class.getCanonicalName() + "\", \"lowercaseExpandedTerms\": false}") .close(); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneRangeTest.java b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneRangeTest.java index 6f62eea0785..0e1637b3ff4 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneRangeTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneRangeTest.java @@ -127,7 +127,8 @@ public void shouldUseRangeQueryMultipleField() { // name and age range OResultSet results = db.query( - "SELECT * FROM Person WHERE [name,surname,date,age] LUCENE 'age:[5 TO 6] name:robert '"); + "SELECT * FROM Person WHERE [name,surname,date,age] LUCENE 'age:[5 TO 6] name:robert " + + " '"); assertThat(results).hasSize(3); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneSkipLimitTest.java b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneSkipLimitTest.java index 41e0741658c..fa9df018251 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneSkipLimitTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneSkipLimitTest.java @@ -41,7 +41,8 @@ public void testContext() { ORID doc = docs.get(9); docs = - db.query("select * from Song where [title] LUCENE \"(title:man)\" skip 10 limit 10") + db + .query("select * from Song where [title] LUCENE \"(title:man)\" skip 10 limit 10") .stream() .map((r) -> r.getIdentity().get()) .collect(Collectors.toList()); @@ -51,7 +52,8 @@ public void testContext() { Assert.assertEquals(docs.contains(doc), false); docs = - db.query("select * from Song where [title] LUCENE \"(title:man)\" skip 14 limit 10") + db + .query("select * from Song where [title] LUCENE \"(title:man)\" skip 14 limit 10") .stream() .map((r) -> r.getIdentity().get()) .collect(Collectors.toList()); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneSortTest.java b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneSortTest.java index b371dd6340f..b7a804a9f1a 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneSortTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/test/LuceneSortTest.java @@ -12,7 +12,542 @@ public class LuceneSortTest extends BaseLuceneTest { private static String DESCRIPTION = - "verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylongverylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylongverylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylongverylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylongverylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylongverylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylongverylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylongverylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylongverylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylongverylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylongverylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylongverylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong"; + "verylong verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylongverylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylongverylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylongverylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylongverylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylongverylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylongverylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylongverylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylongverylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylongverylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylongverylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylongverylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong verylong" + + " verylong verylong verylong verylong verylong verylong verylong verylong"; @Before public void setUp() throws Exception { @@ -30,7 +565,8 @@ public void shouldIndexVeryLongDescriptionWithWildCardConfig() throws Exception db.save(new ODocument("Person").field("description", DESCRIPTION)); db.command( - "create index Person.description on Person(description) FULLTEXT ENGINE LUCENE METADATA { \"*_index_sorted\" : false }") + "create index Person.description on Person(description) FULLTEXT ENGINE LUCENE METADATA" + + " { \"*_index_sorted\" : false }") .close(); long count = @@ -45,7 +581,8 @@ public void shouldIndexVeryLongDescriptionWithSingleField() throws Exception { db.save(new ODocument("Person").field("description", DESCRIPTION)); db.command( - "create index Person.description on Person(description) FULLTEXT ENGINE LUCENE METADATA { \"description_index_sorted\" : false }") + "create index Person.description on Person(description) FULLTEXT ENGINE LUCENE METADATA" + + " { \"description_index_sorted\" : false }") .close(); long count = diff --git a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneContextTest.java b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneContextTest.java index e254c559840..c065169c108 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneContextTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneContextTest.java @@ -64,7 +64,8 @@ public void shouldReturnScore() { public void shouldReturnTotalHits() throws Exception { OResultSet docs = db.query( - "select *,$totalHits,$Song_title_totalHits from Song where search_class('title:man')= true limit 1"); + "select *,$totalHits,$Song_title_totalHits from Song where search_class('title:man')=" + + " true limit 1"); List results = docs.stream().collect(Collectors.toList()); assertThat(results).hasSize(1); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneCreateIndexTest.java b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneCreateIndexTest.java index f281e1c85df..aca17ada6c5 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneCreateIndexTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneCreateIndexTest.java @@ -39,12 +39,14 @@ public void setUp() throws Exception { db.execute("sql", getScriptFromStream(stream)).close(); db.command( - "create index Song.title on Song (title) fulltext ENGINE LUCENE METADATA {\"analyzer\":\"" + "create index Song.title on Song (title) fulltext ENGINE LUCENE METADATA" + + " {\"analyzer\":\"" + StandardAnalyzer.class.getName() + "\"}") .close(); db.command( - "create index Song.author on Song (author) FULLTEXT ENGINE lucene METADATA {\"analyzer\":\"" + "create index Song.author on Song (author) FULLTEXT ENGINE lucene METADATA" + + " {\"analyzer\":\"" + StandardAnalyzer.class.getName() + "\"}") .close(); @@ -76,7 +78,8 @@ public void testQueries() { assertThat(docs).hasSize(87); docs.close(); String query = - "select * from Song where search_fields(['title'],'mountain')=true AND search_fields(['author'],'Fabbio')=true"; + "select * from Song where search_fields(['title'],'mountain')=true AND" + + " search_fields(['author'],'Fabbio')=true"; docs = db.query(query); assertThat(docs).hasSize(1); docs.close(); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneFacetTest.java b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneFacetTest.java index 6bafdeebc98..401f4b4a45a 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneFacetTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneFacetTest.java @@ -42,7 +42,8 @@ public void init() { oClass.createProperty("category", OType.STRING); db.command( - "create index Item.name_category on Item (name,category) FULLTEXT ENGINE LUCENE METADATA { 'facetFields' : ['category']}") + "create index Item.name_category on Item (name,category) FULLTEXT ENGINE LUCENE" + + " METADATA { 'facetFields' : ['category']}") .close(); ODocument doc = new ODocument("Item"); @@ -104,7 +105,8 @@ public void baseFacetTest() { result = db .command( - "select *,$facet from Item where name lucene { 'q' : 'H*', 'drillDown' : 'category:Electronic' } limit 1 ") + "select *,$facet from Item where name lucene { 'q' : 'H*', 'drillDown' :" + + " 'category:Electronic' } limit 1 ") .stream() .map((o) -> o.toElement()) .collect(Collectors.toList()); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneInsertDeleteTest.java b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneInsertDeleteTest.java index a953cc7b032..251cf1d61e4 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneInsertDeleteTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneInsertDeleteTest.java @@ -94,7 +94,8 @@ public void testDeleteWithQueryOnClosedIndex() throws Exception { //noinspection EmptyTryBlock try (OResultSet resultSet = db.command( - "create index Song.title on Song (title) FULLTEXT ENGINE LUCENE metadata {'closeAfterInterval':1000 , 'firstFlushAfter':1000 }")) {} + "create index Song.title on Song (title) FULLTEXT ENGINE LUCENE metadata" + + " {'closeAfterInterval':1000 , 'firstFlushAfter':1000 }")) {} try (OResultSet docs = db.query("select from Song where title lucene 'mountain'")) { diff --git a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneListIndexingTest.java b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneListIndexingTest.java index 51957e254af..f9c9b5e3e07 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneListIndexingTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneListIndexingTest.java @@ -190,7 +190,8 @@ public void testCompositeIndexList() { assertThat(queryFive).hasSize(2); try (OResultSet querySix = db.query( - "select from Person where search_class('(name:Enrico AND tags:Geek) ')=true")) { + "select from Person where search_class('(name:Enrico AND tags:Geek)" + + " ')=true")) { assertThat(querySix).hasSize(1); } } diff --git a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneMiscTest.java b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneMiscTest.java index 2cca78a890f..b179cdb7f7a 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneMiscTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneMiscTest.java @@ -48,25 +48,29 @@ public void testDoubleLucene() { OResultSet results = db.query( - "select from Test where search_index('Test.attr1',\"foo*\") =true OR search_index('Test.attr2', \"foo*\")=true "); + "select from Test where search_index('Test.attr1',\"foo*\") =true OR" + + " search_index('Test.attr2', \"foo*\")=true "); assertThat(results).hasSize(2); results.close(); results = db.query( - "select from Test where SEARCH_FIELDS( ['attr1'], 'bar') = true OR SEARCH_FIELDS(['attr2'], 'bar*' )= true "); + "select from Test where SEARCH_FIELDS( ['attr1'], 'bar') = true OR" + + " SEARCH_FIELDS(['attr2'], 'bar*' )= true "); assertThat(results).hasSize(2); results.close(); results = db.query( - "select from Test where SEARCH_FIELDS( ['attr1'], 'foo*') = true AND SEARCH_FIELDS(['attr2'], 'bar*') = true"); + "select from Test where SEARCH_FIELDS( ['attr1'], 'foo*') = true AND" + + " SEARCH_FIELDS(['attr2'], 'bar*') = true"); assertThat(results).hasSize(1); results.close(); results = db.query( - "select from Test where SEARCH_FIELDS( ['attr1'], 'bar*') = true AND SEARCH_FIELDS(['attr2'], 'foo*')= true"); + "select from Test where SEARCH_FIELDS( ['attr1'], 'bar*') = true AND" + + " SEARCH_FIELDS(['attr2'], 'foo*')= true"); assertThat(results).hasSize(1); results.close(); } @@ -83,7 +87,8 @@ public void testSubLucene() { db.command("insert into Person set name='Enrico', age=18"); String query = - "select from (select from Person where age = 18) where search_fields(['name'],'Enrico') = true"; + "select from (select from Person where age = 18) where search_fields(['name'],'Enrico') =" + + " true"; OResultSet results = db.query(query); assertThat(results).hasSize(1); @@ -92,7 +97,8 @@ public void testSubLucene() { // WITH PROJECTION it works using index directly query = - "select from (select name from Person where age = 18) where search_index('Person.name','Enrico') = true"; + "select from (select name from Person where age = 18) where" + + " search_index('Person.name','Enrico') = true"; results = db.query(query); assertThat(results).hasSize(1); results.close(); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneMixIndexTest.java b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneMixIndexTest.java index c214ee1a219..9a6e5d91e99 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneMixIndexTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneMixIndexTest.java @@ -45,13 +45,15 @@ public void testMixQuery() { OResultSet docs = db.query( - "select * from Song where author = 'Hornsby' and search_index('Song.composite','title:mountain')=true "); + "select * from Song where author = 'Hornsby' and" + + " search_index('Song.composite','title:mountain')=true "); assertThat(docs).hasSize(1); docs.close(); docs = db.query( - "select * from Song where author = 'Hornsby' and search_index('Song.composite','title:ballad')=true"); + "select * from Song where author = 'Hornsby' and" + + " search_index('Song.composite','title:ballad')=true"); assertThat(docs).hasSize(0); docs.close(); } @@ -61,12 +63,14 @@ public void testMixCompositeQuery() { OResultSet docs = db.query( - "select * from Song where author = 'Hornsby' and search_index('Song.composite','title:mountain')=true "); + "select * from Song where author = 'Hornsby' and" + + " search_index('Song.composite','title:mountain')=true "); assertThat(docs).hasSize(1); docs.close(); docs = db.query( - "select * from Song where author = 'Hornsby' and search_index('Song.composite','lyrics:happy')=true "); + "select * from Song where author = 'Hornsby' and" + + " search_index('Song.composite','lyrics:happy')=true "); assertThat(docs).hasSize(1); docs.close(); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneMultiFieldTest.java b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneMultiFieldTest.java index 31259844900..ba559f729e0 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneMultiFieldTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneMultiFieldTest.java @@ -65,7 +65,8 @@ public void init() throws Exception { public void testSelectSingleDocumentWithAndOperator() { try (OResultSet docs = db.query( - "select * from Song where search_fields(['title','author'] ,'title:mountain AND author:Fabbio')=true")) { + "select * from Song where search_fields(['title','author'] ,'title:mountain AND" + + " author:Fabbio')=true")) { assertThat(docs).hasSize(1); } @@ -75,7 +76,8 @@ public void testSelectSingleDocumentWithAndOperator() { public void testSelectMultipleDocumentsWithOrOperator() { try (OResultSet docs = db.query( - "select * from Song where search_fields(['title','author'] ,'title:mountain OR author:Fabbio')=true")) { + "select * from Song where search_fields(['title','author'] ,'title:mountain OR" + + " author:Fabbio')=true")) { assertThat(docs).hasSize(91); } @@ -109,7 +111,8 @@ public void testSelectOnIndexWithIgnoreNullValuesToFalse() { + "create property Item.title string;\n" + "create property Item.summary string;\n" + "create property Item.content string;\n" - + "create index Item.fulltext on Item(title, summary, content) FULLTEXT ENGINE LUCENE METADATA {'ignoreNullValues':false};\n" + + "create index Item.fulltext on Item(title, summary, content) FULLTEXT ENGINE LUCENE" + + " METADATA {'ignoreNullValues':false};\n" + "insert into Item set title = 'wrong', content = 'not me please';\n" + "insert into Item set title = 'test', content = 'this is a test';\n"; diff --git a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneQueryParserTest.java b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneQueryParserTest.java index 4ad043bd772..7de81dce178 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneQueryParserTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneQueryParserTest.java @@ -26,7 +26,8 @@ public void shouldSearchWithLeadingWildcard() { // enabling leading wildcard db.command( - "create index Song.title on Song (title) FULLTEXT ENGINE LUCENE metadata {\"allowLeadingWildcard\": true}"); + "create index Song.title on Song (title) FULLTEXT ENGINE LUCENE metadata" + + " {\"allowLeadingWildcard\": true}"); // querying with leading wildcard OResultSet docs = db.query("select * from Song where search_class(\"(title:*tain)\") = true"); @@ -60,7 +61,8 @@ public void shouldFailIfLeadingWild() { // enabling leading wildcard db.command( - "create index Song.title on Song (title) FULLTEXT ENGINE LUCENE metadata {\"allowLeadingWildcard\": true}"); + "create index Song.title on Song (title) FULLTEXT ENGINE LUCENE metadata" + + " {\"allowLeadingWildcard\": true}"); // querying with leading wildcard OResultSet docs = db.query("select * from Song where search_class ('title:*tain')=true"); @@ -120,7 +122,8 @@ public void shouldUseBoostsFromMap() throws Exception { // querying with boost OResultSet rs = db.query( - "select * from Song where search_class ('title:forever OR author:Boudleaux' , {'boost':{ 'title': 2 } })=true"); + "select * from Song where search_class ('title:forever OR author:Boudleaux' ," + + " {'boost':{ 'title': 2 } })=true"); List boostedDocs = rs.stream().map(r -> r.getProperty("title")).collect(Collectors.toList()); @@ -164,7 +167,8 @@ public void shouldUseBoostsFromMapAndSyntax() throws Exception { // querying with boost OResultSet rs = db.query( - "select $score from Song where search_class ('title:forever OR author:Boudleaux' , {'boost':{ 'title': 2 } })=true order by $score desc"); + "select $score from Song where search_class ('title:forever OR author:Boudleaux' ," + + " {'boost':{ 'title': 2 } })=true order by $score desc"); List boostedDocs = rs.stream().map(r -> r.getProperty("$score")).collect(Collectors.toList()); @@ -174,7 +178,8 @@ public void shouldUseBoostsFromMapAndSyntax() throws Exception { rs = db.query( - "select $score from Song where search_class ('(title:forever)^2 OR author:Boudleaux')=true order by $score desc"); + "select $score from Song where search_class ('(title:forever)^2 OR" + + " author:Boudleaux')=true order by $score desc"); List docs = rs.stream().map(r -> r.getProperty("$score")).collect(Collectors.toList()); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneRangeTest.java b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneRangeTest.java index 87b71e86c2b..fa6ffbf5f5d 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneRangeTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneRangeTest.java @@ -150,7 +150,8 @@ public void shouldUseRangeQueryMultipleField() { //noinspection EmptyTryBlock try (OResultSet command = db.command( - "create index Person.composite on Person(name,surname,date,age) FULLTEXT ENGINE LUCENE")) {} + "create index Person.composite on Person(name,surname,date,age) FULLTEXT ENGINE" + + " LUCENE")) {} assertThat( db.getMetadata() @@ -203,7 +204,8 @@ public void shouldUseRangeQueryMultipleFieldWithDirectIndexAccess() { //noinspection EmptyTryBlock try (OResultSet command = db.command( - "create index Person.composite on Person(name,surname,date,age) FULLTEXT ENGINE LUCENE")) {} + "create index Person.composite on Person(name,surname,date,age) FULLTEXT ENGINE" + + " LUCENE")) {} assertThat( db.getMetadata() diff --git a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneSingleFieldEmbeddedTest.java b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneSingleFieldEmbeddedTest.java index ec69b304dc7..290ef7c8412 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneSingleFieldEmbeddedTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneSingleFieldEmbeddedTest.java @@ -53,7 +53,8 @@ public void loadAndTest() { docs.close(); docs = db.query( - "select * from Song where search_fields(['title'],\"(title:mountain)\")=true and search_fields(['author'],\"(author:Fabbio)\")=true"); + "select * from Song where search_fields(['title'],\"(title:mountain)\")=true and" + + " search_fields(['author'],\"(author:Fabbio)\")=true"); assertThat(docs).hasSize(1); docs.close(); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneSkipLimitTest.java b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneSkipLimitTest.java index a3872e3f3be..69aca96c823 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneSkipLimitTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneSkipLimitTest.java @@ -47,7 +47,8 @@ public void testContext() { docs.close(); docs = db.query( - "select * from Song where search_fields(['title'],\"(title:man)\")=true skip 10 limit 10"); + "select * from Song where search_fields(['title'],\"(title:man)\")=true skip 10 limit" + + " 10"); Assertions.assertThat(docs).hasSize(4); @@ -55,7 +56,8 @@ public void testContext() { docs.close(); docs = db.query( - "select * from Song where search_fields(['title'],\"(title:man)\")=true skip 14 limit 10"); + "select * from Song where search_fields(['title'],\"(title:man)\")=true skip 14 limit" + + " 10"); Assertions.assertThat(docs).hasSize(0); docs.close(); diff --git a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneSortTest.java b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneSortTest.java index 72814c33d5d..ad2a9291f34 100644 --- a/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneSortTest.java +++ b/lucene/src/test/java/com/orientechnologies/lucene/tests/OLuceneSortTest.java @@ -132,9 +132,9 @@ public void shouldSortByReverseScoreFieldValueAndThenReverseName() throws Except OResultSet resultSet = db.query( - "SELECT score, name from Author where SEARCH_CLASS('*:* ', {" - + "sort: [ { 'field': 'score', reverse:true, type:'INT' },{field: 'name', type:'STRING' , reverse:true}] " - + "} ) = true "); + "SELECT score, name from Author where SEARCH_CLASS('*:* ', {sort: [ { 'field': 'score'," + + " reverse:true, type:'INT' },{field: 'name', type:'STRING' , reverse:true}] } ) =" + + " true "); List names = resultSet.stream() diff --git a/lucene/src/test/java/com/orientechnologies/spatial/BaseSpatialLuceneTest.java b/lucene/src/test/java/com/orientechnologies/spatial/BaseSpatialLuceneTest.java index bee4817ce72..6018512a207 100644 --- a/lucene/src/test/java/com/orientechnologies/spatial/BaseSpatialLuceneTest.java +++ b/lucene/src/test/java/com/orientechnologies/spatial/BaseSpatialLuceneTest.java @@ -51,9 +51,32 @@ public abstract class BaseSpatialLuceneTest extends BaseLuceneTest { "POLYGON ((-45 -30, -45 30, 45 30, 45 -30, -45 -30))"; protected static final String POLYGONWKT = "POLYGON ((-71.1776585052917 42.3902909739571, -71.1776820268866 42.3903701743239," - + " -71.1776063012595 42.3903825660754, -71.1775826583081 42.3903033653531, -71.1776585052917 42.3902909739571))"; + + " -71.1776063012595 42.3903825660754, -71.1775826583081 42.3903033653531," + + " -71.1776585052917 42.3902909739571))"; protected static final String MULTIPOLYGONWKT = - "MULTIPOLYGON (((15.520376 38.231155, 15.160243 37.444046, 15.309898 37.134219, 15.099988 36.619987, 14.335229 36.996631, 13.826733 37.104531, 12.431004 37.61295, 12.570944 38.126381, 13.741156 38.034966, 14.761249 38.143874, 15.520376 38.231155)), ((9.210012 41.209991, 9.809975 40.500009, 9.669519 39.177376, 9.214818 39.240473, 8.806936 38.906618, 8.428302 39.171847, 8.388253 40.378311, 8.159998 40.950007, 8.709991 40.899984, 9.210012 41.209991)), ((12.376485 46.767559, 13.806475 46.509306, 13.69811 46.016778, 13.93763 45.591016, 13.141606 45.736692, 12.328581 45.381778, 12.383875 44.885374, 12.261453 44.600482, 12.589237 44.091366, 13.526906 43.587727, 14.029821 42.761008, 15.14257 41.95514, 15.926191 41.961315, 16.169897 41.740295, 15.889346 41.541082, 16.785002 41.179606, 17.519169 40.877143, 18.376687 40.355625, 18.480247 40.168866, 18.293385 39.810774, 17.73838 40.277671, 16.869596 40.442235, 16.448743 39.795401, 17.17149 39.4247, 17.052841 38.902871, 16.635088 38.843572, 16.100961 37.985899, 15.684087 37.908849, 15.687963 38.214593, 15.891981 38.750942, 16.109332 38.964547, 15.718814 39.544072, 15.413613 40.048357, 14.998496 40.172949, 14.703268 40.60455, 14.060672 40.786348, 13.627985 41.188287, 12.888082 41.25309, 12.106683 41.704535, 11.191906 42.355425, 10.511948 42.931463, 10.200029 43.920007, 9.702488 44.036279, 8.888946 44.366336, 8.428561 44.231228, 7.850767 43.767148, 7.435185 43.693845, 7.549596 44.127901, 7.007562 44.254767, 6.749955 45.028518, 7.096652 45.333099, 6.802355 45.70858, 6.843593 45.991147, 7.273851 45.776948, 7.755992 45.82449, 8.31663 46.163642, 8.489952 46.005151, 8.966306 46.036932, 9.182882 46.440215, 9.922837 46.314899, 10.363378 46.483571, 10.442701 46.893546, 11.048556 46.751359, 11.164828 46.941579, 12.153088 47.115393, 12.376485 46.767559)))"; + "MULTIPOLYGON (((15.520376 38.231155, 15.160243 37.444046, 15.309898 37.134219, 15.099988" + + " 36.619987, 14.335229 36.996631, 13.826733 37.104531, 12.431004 37.61295, 12.570944" + + " 38.126381, 13.741156 38.034966, 14.761249 38.143874, 15.520376 38.231155))," + + " ((9.210012 41.209991, 9.809975 40.500009, 9.669519 39.177376, 9.214818 39.240473," + + " 8.806936 38.906618, 8.428302 39.171847, 8.388253 40.378311, 8.159998 40.950007," + + " 8.709991 40.899984, 9.210012 41.209991)), ((12.376485 46.767559, 13.806475 46.509306," + + " 13.69811 46.016778, 13.93763 45.591016, 13.141606 45.736692, 12.328581 45.381778," + + " 12.383875 44.885374, 12.261453 44.600482, 12.589237 44.091366, 13.526906 43.587727," + + " 14.029821 42.761008, 15.14257 41.95514, 15.926191 41.961315, 16.169897 41.740295," + + " 15.889346 41.541082, 16.785002 41.179606, 17.519169 40.877143, 18.376687 40.355625," + + " 18.480247 40.168866, 18.293385 39.810774, 17.73838 40.277671, 16.869596 40.442235," + + " 16.448743 39.795401, 17.17149 39.4247, 17.052841 38.902871, 16.635088 38.843572," + + " 16.100961 37.985899, 15.684087 37.908849, 15.687963 38.214593, 15.891981 38.750942," + + " 16.109332 38.964547, 15.718814 39.544072, 15.413613 40.048357, 14.998496 40.172949," + + " 14.703268 40.60455, 14.060672 40.786348, 13.627985 41.188287, 12.888082 41.25309," + + " 12.106683 41.704535, 11.191906 42.355425, 10.511948 42.931463, 10.200029 43.920007," + + " 9.702488 44.036279, 8.888946 44.366336, 8.428561 44.231228, 7.850767 43.767148," + + " 7.435185 43.693845, 7.549596 44.127901, 7.007562 44.254767, 6.749955 45.028518," + + " 7.096652 45.333099, 6.802355 45.70858, 6.843593 45.991147, 7.273851 45.776948," + + " 7.755992 45.82449, 8.31663 46.163642, 8.489952 46.005151, 8.966306 46.036932," + + " 9.182882 46.440215, 9.922837 46.314899, 10.363378 46.483571, 10.442701 46.893546," + + " 11.048556 46.751359, 11.164828 46.941579, 12.153088 47.115393, 12.376485" + + " 46.767559)))"; protected static final String GEOMETRYCOLLECTION = "GEOMETRYCOLLECTION (POINT (4 6), LINESTRING (4 6, 7 10))"; protected JtsSpatialContext context = JtsSpatialContext.GEO; diff --git a/lucene/src/test/java/com/orientechnologies/spatial/GeometryCollectionTest.java b/lucene/src/test/java/com/orientechnologies/spatial/GeometryCollectionTest.java index 9ba80e90f1d..48cb6f012cb 100644 --- a/lucene/src/test/java/com/orientechnologies/spatial/GeometryCollectionTest.java +++ b/lucene/src/test/java/com/orientechnologies/spatial/GeometryCollectionTest.java @@ -18,16 +18,19 @@ public void testDeleteVerticesWithGeometryCollection() { db.command( new OCommandSQL( - "insert into TestInsert content {'name': 'loc1', 'geometry': {'@type':'d','@class':'OGeometryCollection','geometries':[{'@type':'d','@class':'OPolygon','coordinates':[[[0,0],[0,10],[10,10],[10,0],[0,0]]]}]}}")) + "insert into TestInsert content {'name': 'loc1', 'geometry':" + + " {'@type':'d','@class':'OGeometryCollection','geometries':[{'@type':'d','@class':'OPolygon','coordinates':[[[0,0],[0,10],[10,10],[10,0],[0,0]]]}]}}")) .execute(); db.command( new OCommandSQL( - "insert into TestInsert content {'name': 'loc2', 'geometry': {'@type':'d','@class':'OGeometryCollection','geometries':[{'@type':'d','@class':'OPolygon','coordinates':[[[0,0],[0,20],[20,20],[20,0],[0,0]]]}]}}")) + "insert into TestInsert content {'name': 'loc2', 'geometry':" + + " {'@type':'d','@class':'OGeometryCollection','geometries':[{'@type':'d','@class':'OPolygon','coordinates':[[[0,0],[0,20],[20,20],[20,0],[0,0]]]}]}}")) .execute(); OResultSet qResult = db.command( - "select * from TestInsert where ST_WITHIN(geometry,'POLYGON ((0 0, 15 0, 15 15, 0 15, 0 0))') = true"); + "select * from TestInsert where ST_WITHIN(geometry,'POLYGON ((0 0, 15 0, 15 15, 0 15, 0" + + " 0))') = true"); Assert.assertEquals(1, qResult.stream().count()); db.command("DELETE VERTEX TestInsert").close(); diff --git a/lucene/src/test/java/com/orientechnologies/spatial/LuceneGeoUpdateTest.java b/lucene/src/test/java/com/orientechnologies/spatial/LuceneGeoUpdateTest.java index 31cb0c38866..1464c207e87 100644 --- a/lucene/src/test/java/com/orientechnologies/spatial/LuceneGeoUpdateTest.java +++ b/lucene/src/test/java/com/orientechnologies/spatial/LuceneGeoUpdateTest.java @@ -31,7 +31,8 @@ public void testUpdate() { db.command("CREATE INDEX City.location ON City(location) SPATIAL ENGINE LUCENE").close(); db.command( - "insert into City set name = 'TestInsert' , location = ST_GeomFromText('POINT(-160.2075374 21.9029803)')") + "insert into City set name = 'TestInsert' , location =" + + " ST_GeomFromText('POINT(-160.2075374 21.9029803)')") .close(); OIndex index = db.getMetadata().getIndexManagerInternal().getIndex(db, "City.location"); diff --git a/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialAutomaticBackupRestoreTest.java b/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialAutomaticBackupRestoreTest.java index fe1871541a9..d23cd76f6bb 100755 --- a/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialAutomaticBackupRestoreTest.java +++ b/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialAutomaticBackupRestoreTest.java @@ -162,8 +162,9 @@ public void tearDown() throws Exception { public void shouldBackupAndRestore() throws IOException, InterruptedException { String query = - "select * from City where ST_WITHIN(location,'POLYGON ((12.314015 41.8262816, 12.314015 41.963125, 12.6605063 41.963125, 12.6605063 41.8262816, 12.314015 41.8262816))')" - + " = true"; + "select * from City where ST_WITHIN(location,'POLYGON ((12.314015 41.8262816, 12.314015" + + " 41.963125, 12.6605063 41.963125, 12.6605063 41.8262816, 12.314015 41.8262816))') =" + + " true"; OResultSet docs = db.query(query); Assert.assertEquals(docs.stream().count(), 1); @@ -242,8 +243,9 @@ public void onBackupError(String database, Exception e) { public void shouldExportImport() throws IOException, InterruptedException { String query = - "select * from City where ST_WITHIN(location,'POLYGON ((12.314015 41.8262816, 12.314015 41.963125, 12.6605063 41.963125, 12.6605063 41.8262816, 12.314015 41.8262816))')" - + " = true"; + "select * from City where ST_WITHIN(location,'POLYGON ((12.314015 41.8262816, 12.314015" + + " 41.963125, 12.6605063 41.963125, 12.6605063 41.8262816, 12.314015 41.8262816))') =" + + " true"; OResultSet docs = db.query(query); Assert.assertEquals(docs.stream().count(), 1); diff --git a/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialLineStringTest.java b/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialLineStringTest.java index cec854f7e4e..c87cf71de34 100644 --- a/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialLineStringTest.java +++ b/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialLineStringTest.java @@ -34,7 +34,8 @@ public class LuceneSpatialLineStringTest extends BaseSpatialLuceneTest { public static String LINEWKT = - "LINESTRING(-149.8871332 61.1484656,-149.8871655 61.1489556,-149.8871569 61.15043,-149.8870366 61.1517722)"; + "LINESTRING(-149.8871332 61.1484656,-149.8871655 61.1489556,-149.8871569" + + " 61.15043,-149.8870366 61.1517722)"; @Before public void initMore() { @@ -100,7 +101,8 @@ public void testLineStringWithoutIndex() throws IOException { protected void queryLineString() { String query = - "select * from Place where location && { 'shape' : { 'type' : 'OLineString' , 'coordinates' : [[1,2],[4,6]]} } "; + "select * from Place where location && { 'shape' : { 'type' : 'OLineString' , 'coordinates'" + + " : [[1,2],[4,6]]} } "; List docs = db.query(new OSQLSynchQuery(query)); Assert.assertEquals(docs.size(), 1); @@ -116,7 +118,10 @@ protected void queryLineString() { Assert.assertEquals(docs.size(), 1); query = - "select * from Place where location && 'POLYGON((-150.205078125 61.40723633876356,-149.2657470703125 61.40723633876356,-149.2657470703125 61.05562700886678,-150.205078125 61.05562700886678,-150.205078125 61.40723633876356))' "; + "select * from Place where location && 'POLYGON((-150.205078125" + + " 61.40723633876356,-149.2657470703125 61.40723633876356,-149.2657470703125" + + " 61.05562700886678,-150.205078125 61.05562700886678,-150.205078125" + + " 61.40723633876356))' "; docs = db.query(new OSQLSynchQuery(query)); Assert.assertEquals(docs.size(), 1); diff --git a/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialMemoryTest.java b/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialMemoryTest.java index 231e3dd8051..d8bcf724559 100644 --- a/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialMemoryTest.java +++ b/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialMemoryTest.java @@ -60,7 +60,8 @@ public void boundingBoxTest() { List query = db.query( new OSQLSynchQuery( - "SELECT FROM Point WHERE [latitude, longitude] WITHIN [[42.26531323615103,-83.71986351411135],[42.29239784478525,-83.7662120858887]]")); + "SELECT FROM Point WHERE [latitude, longitude] WITHIN" + + " [[42.26531323615103,-83.71986351411135],[42.29239784478525,-83.7662120858887]]")); Assert.assertEquals(query.size(), 1); } finally { @@ -96,7 +97,8 @@ public void boundingBoxTestTxRollBack() { List query = db.query( new OSQLSynchQuery( - "SELECT FROM Point WHERE [latitude, longitude] WITHIN [[42.26531323615103,-83.71986351411135],[42.29239784478525,-83.7662120858887]]")); + "SELECT FROM Point WHERE [latitude, longitude] WITHIN" + + " [[42.26531323615103,-83.71986351411135],[42.29239784478525,-83.7662120858887]]")); Assert.assertEquals(1, query.size()); @@ -137,7 +139,8 @@ public void boundingBoxTestTxRollBack() { query = db.query( new OSQLSynchQuery( - "SELECT FROM Point WHERE [latitude, longitude] WITHIN [[42.26531323615103,-83.71986351411135],[42.29239784478525,-83.7662120858887]]")); + "SELECT FROM Point WHERE [latitude, longitude] WITHIN" + + " [[42.26531323615103,-83.71986351411135],[42.29239784478525,-83.7662120858887]]")); Assert.assertEquals(0, query.size()); @@ -176,7 +179,8 @@ public void boundingBoxTestTxCommit() { List query = db.query( new OSQLSynchQuery( - "SELECT FROM Point WHERE [latitude, longitude] WITHIN [[42.26531323615103,-83.71986351411135],[42.29239784478525,-83.7662120858887]]")); + "SELECT FROM Point WHERE [latitude, longitude] WITHIN" + + " [[42.26531323615103,-83.71986351411135],[42.29239784478525,-83.7662120858887]]")); Assert.assertEquals(1, query.size()); @@ -221,7 +225,8 @@ public void boundingBoxTestTxCommit() { query = db.query( new OSQLSynchQuery( - "SELECT FROM Point WHERE [latitude, longitude] WITHIN [[42.26531323615103,-83.71986351411135],[42.29239784478525,-83.7662120858887]]")); + "SELECT FROM Point WHERE [latitude, longitude] WITHIN" + + " [[42.26531323615103,-83.71986351411135],[42.29239784478525,-83.7662120858887]]")); Assert.assertEquals(0, query.size()); @@ -236,7 +241,8 @@ public void boundingBoxTestTxCommit() { query = db.query( new OSQLSynchQuery( - "SELECT FROM Point WHERE [latitude, longitude] WITHIN [[42.26531323615103,-83.71986351411135],[42.29239784478525,-83.7662120858887]]")); + "SELECT FROM Point WHERE [latitude, longitude] WITHIN" + + " [[42.26531323615103,-83.71986351411135],[42.29239784478525,-83.7662120858887]]")); Assert.assertEquals(1, query.size()); diff --git a/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialMultiLineStringTest.java b/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialMultiLineStringTest.java index 94ace414b1b..7c9fb9f5ba1 100644 --- a/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialMultiLineStringTest.java +++ b/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialMultiLineStringTest.java @@ -30,7 +30,186 @@ public class LuceneSpatialMultiLineStringTest extends BaseSpatialLuceneTest { protected static String WKT = - "MULTILINESTRING((-158.0630142 21.3631108,-158.0632373 21.3625033,-158.0633575 21.3619997,-158.0634776 21.3613922,-158.0642072 21.3576912,-158.0643789 21.3570517,-158.0645591 21.3564442,-158.064817 21.3557286,-158.0651428 21.3550453,-158.0654432 21.3544698,-158.0658552 21.3537903,-158.0662242 21.3532227,-158.0668165 21.3524633,-158.0673915 21.3518558,-158.0741478 21.3455763,-158.0760433 21.3438376,-158.0776483 21.3423267,-158.0786096 21.3414713,-158.0792104 21.3408397,-158.0796297 21.3404253,-158.0798026 21.3402481,-158.0826506 21.3369385,-158.0831127 21.3364014,-158.0834075 21.3360589,-158.0837122 21.3357062,-158.083788 21.3356184,-158.0851756 21.3340122,-158.0856134 21.3336045,-158.0860168 21.3333086,-158.0864288 21.3330528,-158.0869695 21.332773,-158.0875961 21.3325491,-158.0882398 21.3323812,-158.0887033 21.3323013,-158.089244 21.3322773,-158.0897933 21.3322773,-158.0904285 21.3323013,-158.0909864 21.3324052,-158.0914756 21.3325811,-158.0920507 21.332805,-158.0926397 21.3331239,-158.0931267 21.333463,-158.0936268 21.3339656,-158.093814 21.3342067),(-158.0608129 21.3660325,-158.0613708 21.3655329,-158.0618214 21.3650933,-158.0621266 21.3647301,-158.0624056 21.3643304,-158.0626368 21.3639343,-158.0628347 21.363591,-158.0630142 21.3631108),(-158.0596223 21.3670474,-158.0608129 21.3660325),(-158.0441757 21.3776379,-158.048071 21.3761154,-158.0488006 21.3758276,-158.0492727 21.3756118,-158.0498563 21.3753001,-158.0505515 21.3748685,-158.0511609 21.3744609,-158.0517274 21.3740213,-158.052251 21.3735977,-158.0526973 21.373198,-158.0563069 21.369968,-158.0596223 21.3670474),(-158.0435563 21.3778737,-158.0441757 21.3776379),(-158.0324485 21.3837899,-158.0343467 21.3826132,-158.0383392 21.380405,-158.039385 21.379744,-158.0402519 21.3792724,-158.0410329 21.3788968,-158.041711 21.3786011,-158.0426294 21.3782414,-158.0435563 21.3778737),(-158.0320356 21.3840079,-158.0324485 21.3837899),(-158.023442 21.3888547,-158.0267354 21.3869747,-158.0277935 21.3863772,-158.028972 21.3857107,-158.0320356 21.3840079),(-158.0231409 21.3890189,-158.023442 21.3888547),(-158.0191075 21.390625,-158.0209094 21.3900405,-158.021798 21.3896905,-158.0226534 21.3892749,-158.0231409 21.3890189),(-158.0165725 21.3914004,-158.0191075 21.390625),(-158.0098819 21.3961801,-158.0106489 21.3956401,-158.0115243 21.3948729,-158.0122625 21.3942175,-158.0132581 21.3933305,-158.0139276 21.3927631,-158.0142967 21.3924594,-158.0148202 21.3921317,-158.0153781 21.391852,-158.0159103 21.3916362,-158.0165725 21.3914004),(-158.0094038 21.3965163,-158.0098819 21.3961801),(-158.0000745 21.3993481,-158.0006152 21.399404,-158.001259 21.39942,-158.001937 21.399404,-158.0025636 21.3993161,-158.0031215 21.3992282,-158.0036107 21.3991163,-158.0044776 21.3988926,-158.0052158 21.3986528,-158.0061427 21.3982932,-158.0070611 21.3978937,-158.0077993 21.3975101,-158.0084001 21.3971584,-158.0094038 21.3965163),(-157.9995749 21.3992637,-158.0000745 21.3993481),(-157.9785825 21.3934344,-157.9795867 21.3938659,-157.980445 21.3942016,-157.9821788 21.3948809,-157.9828483 21.3951765,-157.9836894 21.395648,-157.9841272 21.3959038,-157.9848911 21.3964152,-157.9854919 21.3968308,-157.9860841 21.3972144,-157.9866248 21.3975021,-157.9871398 21.3977019,-157.987878 21.3979336,-157.9888921 21.3981294,-157.9894229 21.3981813,-157.989895 21.3981813,-157.9907203 21.3980974,-157.991407 21.3980494,-157.9921094 21.3979896,-157.9927446 21.3979816,-157.9934069 21.398023,-157.9941865 21.3981494,-157.9954654 21.3984291,-157.9975768 21.3988766,-157.9990639 21.3991671,-157.9995749 21.3992637),(-157.9620701 21.3912806,-157.9642145 21.3904694,-157.9646865 21.3903336,-157.9654332 21.3901577,-157.9661232 21.3900378,-157.9668129 21.3899789,-157.9675876 21.3899579,-157.9683858 21.3899739,-157.9689266 21.3900299,-157.9695875 21.3901338,-157.9702226 21.3902776,-157.970832 21.3904614,-157.9713384 21.3906133,-157.9767146 21.392707,-157.9785825 21.3934344),(-157.9596998 21.3922676,-157.9620701 21.3912806),(-157.9588428 21.3926072,-157.9596998 21.3922676),(-157.9531852 21.3931227,-157.9539437 21.3933065,-157.9544973 21.3933845,-157.9550477 21.3934264,-157.9557344 21.3934024,-157.9563953 21.3933385,-157.957039 21.3932106,-157.9577771 21.3930268,-157.958438 21.392787,-157.9588428 21.3926072),(-157.9487134 21.3914924,-157.9514257 21.3924993,-157.9526616 21.3929549,-157.9531852 21.3931227),(-157.94517 21.3902176,-157.9487134 21.3914924),(-157.9260741 21.3703845,-157.9255048 21.3715515,-157.9252902 21.372103,-157.9252044 21.3725267,-157.9251701 21.3731661,-157.9251958 21.3738774,-157.925316 21.3744449,-157.9254876 21.3749165,-157.9257623 21.3754999,-157.926037 21.3758676,-157.9268094 21.3768987,-157.9279277 21.3784371,-157.9288951 21.379776,-157.9311439 21.3827731,-157.9319679 21.3839,-157.9321653 21.3841797,-157.9325086 21.3845953,-157.9330922 21.3851787,-157.9335643 21.3855624,-157.934148 21.3859859,-157.9345342 21.3862097,-157.9349891 21.3864814,-157.9355985 21.3867452,-157.9363023 21.3870169,-157.9372121 21.3873366,-157.9388171 21.387944,-157.9406295 21.3885953,-157.94517 21.3902176),(-157.9262296 21.3700398,-157.9260741 21.3703845),(-157.9271289 21.3680868,-157.9267494 21.3689139,-157.9262296 21.3700398),(-157.92935 21.3633586,-157.9277266 21.3668181,-157.9271289 21.3680868),(-157.932281 21.3430995,-157.9326631 21.3438296,-157.9328262 21.3441814,-157.9330064 21.3446371,-157.9331952 21.3453166,-157.9332982 21.3459002,-157.9333645 21.3462826,-157.9334098 21.3470753,-157.9333583 21.3477468,-157.9332897 21.3482265,-157.9325453 21.3518856,-157.9317447 21.3558207,-157.93144 21.3572618,-157.9311954 21.3584186,-157.9310323 21.3591541,-157.9308006 21.3599374,-157.9306032 21.360513,-157.9303972 21.3610565,-157.92935 21.3633586),(-157.9321067 21.3427872,-157.932281 21.3430995),(-157.9301713 21.3407513,-157.930689 21.3411835,-157.931204 21.3416711,-157.9316794 21.3422123,-157.9321067 21.3427872),(-157.8880433 21.3354212,-157.8887053 21.3350056,-157.8892976 21.3347577,-157.889907 21.3345739,-157.8905078 21.3344539,-157.8908254 21.334414,-157.8912373 21.33439,-157.8918038 21.334382,-157.8927194 21.3344641,-157.8935977 21.3345339,-157.8944131 21.3345898,-157.8949281 21.3346458,-157.8957778 21.3346858,-157.8964473 21.3347337,-157.896988 21.3347897,-157.8977347 21.3348617,-157.8984986 21.3349256,-157.8991853 21.3350136,-157.9001122 21.3351495,-157.9023782 21.3355013,-157.9046012 21.335837,-157.9089052 21.3364906,-157.9210159 21.3382654,-157.9257881 21.338985,-157.9265949 21.3391289,-157.9274446 21.3393607,-157.9281312 21.3396085,-157.928835 21.3399283,-157.9294874 21.3402881,-157.9301713 21.3407513),(-157.884067 21.3378087,-157.8843262 21.337798,-157.8845222 21.3377673,-157.8847344 21.3377006,-157.8849917 21.3375962,-157.8852568 21.3374482,-157.8880433 21.3354212),(-157.8834549 21.337632,-157.8835766 21.3376898,-157.8836831 21.3377293,-157.8837852 21.337763,-157.8839272 21.3377946,-157.884067 21.3378087),(-157.8779177 21.3359254,-157.8782283 21.3360045,-157.8786184 21.3360972,-157.879148 21.3362233,-157.8798816 21.3363157,-157.8802768 21.3363487,-157.8811179 21.3364526,-157.8813425 21.3364889,-157.8817419 21.3366011,-157.8820432 21.3367175,-157.882462 21.3369177,-157.882755 21.3371103,-157.8831006 21.337404,-157.8834549 21.337632),(-157.8774238 21.3357688,-157.8779177 21.3359254),(-157.8699993 21.3303273,-157.8705006 21.3309361,-157.8708354 21.3312719,-157.8719649 21.3323197,-157.8729297 21.3332147,-157.873867 21.3339573,-157.8744463 21.3343201,-157.8750358 21.3346776,-157.8756997 21.3350405,-157.8763352 21.3353138,-157.8765871 21.3354181,-157.8769582 21.3356123,-157.8774238 21.3357688),(-157.8696388 21.3298636,-157.8699993 21.3303273),(-157.8676654 21.3269647,-157.8680077 21.3274554,-157.8696388 21.3298636),(-157.8672534 21.3263891,-157.8676654 21.3269647),(-157.8657613 21.3245853,-157.8658855 21.3246834,-157.8660063 21.3247874,-157.8661185 21.3248954,-157.8662269 21.325009,-157.8663387 21.325136,-157.8664482 21.3252711,-157.8668614 21.3258592,-157.8672534 21.3263891),(-157.8625422 21.3236073,-157.8627321 21.3236729,-157.8629153 21.3237268,-157.863111 21.323773,-157.863318 21.3238126,-157.8642807 21.3239695,-157.8644734 21.3240059,-157.8646852 21.324059,-157.8648726 21.3241223,-157.8650638 21.3241938,-157.8652474 21.3242762,-157.865433 21.3243737,-157.8656065 21.3244785,-157.8657613 21.3245853),(-157.8577497 21.318385,-157.8601337 21.3213251,-157.8610717 21.3225075,-157.8611888 21.3226469,-157.8613107 21.3227847,-157.8614371 21.3229076,-157.8615734 21.3230303,-157.8617231 21.3231496,-157.861866 21.3232527,-157.8620194 21.3233524,-157.862193 21.3234508,-157.8623649 21.3235323,-157.8625422 21.3236073),(-157.857535 21.3181186,-157.8577497 21.318385),(-157.8527098 21.3118395,-157.8527841 21.3119802,-157.8528635 21.3121266,-157.8529431 21.3122691,-157.8530349 21.3124226,-157.8531222 21.3125599,-157.8532171 21.3127056,-157.8533232 21.3128576,-157.8534206 21.3129927,-157.8535182 21.3131266,-157.8536302 21.3132727,-157.8552278 21.3152554,-157.8559235 21.3161187,-157.857535 21.3181186),(-157.8524584 21.3112802,-157.8525154 21.3114221,-157.8525766 21.3115624,-157.8526387 21.311695,-157.8527098 21.3118395),(-157.845235 21.304549,-157.8473693 21.3052736,-157.8476942 21.3053857,-157.8491443 21.3058863,-157.8493537 21.3059624,-157.8495536 21.306041,-157.849738 21.306128,-157.8499141 21.3062216,-157.8500919 21.3063316,-157.8502358 21.306437,-157.850372 21.3065471,-157.8504924 21.3066568,-157.8506296 21.3067891,-157.8507428 21.3069114,-157.850849 21.3070408,-157.8509506 21.3071733,-157.8510586 21.3073289,-157.8511557 21.3074802,-157.8512438 21.3076427,-157.8513095 21.3077835,-157.8513766 21.3079412,-157.8514345 21.3081034,-157.8521655 21.3104222,-157.852293 21.3108264,-157.8523457 21.3109812,-157.8524016 21.3111335,-157.8524584 21.3112802),(-157.8396763 21.3026507,-157.8398556 21.3026918,-157.840031 21.3027429,-157.8402064 21.3028011,-157.8423195 21.3035619,-157.8442855 21.3042316,-157.845235 21.304549),(-157.8366046 21.3022191,-157.8370683 21.3022818,-157.8391014 21.3025567,-157.839294 21.3025831,-157.8394858 21.3026148,-157.8396763 21.3026507),(-157.8214474 21.2947647,-157.8219341 21.2950513,-157.8231495 21.2957177,-157.8241704 21.2962774,-157.8243481 21.2963691,-157.8245412 21.2964598,-157.824718 21.2965341,-157.8248975 21.2966015,-157.8294163 21.2982471,-157.8296205 21.2983233,-157.8298046 21.2983959,-157.8299944 21.2984818,-157.830185 21.2985748,-157.8303701 21.2986773,-157.8305703 21.2987983,-157.8320661 21.2997696,-157.8347249 21.3015078,-157.8348971 21.3016169,-157.8350745 21.3017196,-157.8352586 21.301813,-157.8354404 21.3018959,-157.8356261 21.3019703,-157.835818 21.3020374,-157.8360031 21.302093,-157.8362049 21.3021455,-157.8364101 21.3021884,-157.8366046 21.3022191),(-157.8210282 21.2944178,-157.8212139 21.2945766,-157.8214474 21.2947647),(-157.8158031 21.2898165,-157.8176218 21.2909112,-157.8182984 21.2914191,-157.8190411 21.2921377,-157.8195581 21.2927893,-157.8201032 21.2934761,-157.8203826 21.2937817,-157.8206628 21.2940749,-157.8210282 21.2944178),(-157.8155037 21.2896406,-157.8158031 21.2898165),(-157.8142763 21.2889252,-157.8155037 21.2896406),(-157.8120803 21.287036,-157.8123453 21.287334,-157.8127132 21.2877382,-157.8129056 21.2879216,-157.8130647 21.2880665,-157.8132762 21.2882329,-157.8136278 21.288499,-157.8139399 21.288709,-157.8142763 21.2889252),(-157.8026247 21.2815767,-157.802923 21.2817301,-157.8036063 21.282084,-157.8100483 21.2853797,-157.8102541 21.2854856,-157.8104603 21.2856021,-157.8106545 21.2857223,-157.8108344 21.2858429,-157.8110107 21.2859701,-157.8111756 21.2861008,-157.8113239 21.2862273,-157.8114661 21.286356,-157.8117107 21.2866267,-157.8120803 21.287036),(-157.8023689 21.2814452,-157.8026247 21.2815767),(-157.7898518 21.2790207,-157.7905107 21.2791329,-157.7907155 21.2791607,-157.7909138 21.2791782,-157.7911077 21.2791895,-157.7913211 21.279189,-157.7915211 21.2791802,-157.7917238 21.2791595,-157.7919242 21.2791294,-157.7921181 21.2790892,-157.7923012 21.2790418,-157.7928694 21.278876,-157.793257 21.2787629,-157.793454 21.2787132,-157.7936521 21.2786687,-157.7938514 21.2786283,-157.7940472 21.2785974,-157.7942416 21.2785718,-157.7944329 21.2785522,-157.7946564 21.2785377,-157.79488 21.2785296,-157.7950901 21.2785275,-157.7953063 21.2785327,-157.7955116 21.2785435,-157.7957064 21.278559,-157.7958976 21.2785808,-157.7960954 21.2786092,-157.7962945 21.2786432,-157.7964912 21.2786832,-157.7966827 21.278728,-157.7968837 21.2787801,-157.7970828 21.2788356,-157.7972787 21.2788977,-157.7974937 21.2789766,-157.7976905 21.2790582,-157.7978878 21.2791467,-157.7980886 21.2792445,-157.7982826 21.2793437,-157.8023689 21.2814452),(-157.7835222 21.2783209,-157.7887428 21.278832,-157.7889936 21.2788595,-157.7892498 21.2789019,-157.7894749 21.2789586,-157.7898518 21.2790207),(-157.7805411 21.2780102,-157.7810196 21.27806,-157.7835222 21.2783209),(-157.7797623 21.2779215,-157.7805411 21.2780102))"; + "MULTILINESTRING((-158.0630142 21.3631108,-158.0632373 21.3625033,-158.0633575" + + " 21.3619997,-158.0634776 21.3613922,-158.0642072 21.3576912,-158.0643789" + + " 21.3570517,-158.0645591 21.3564442,-158.064817 21.3557286,-158.0651428" + + " 21.3550453,-158.0654432 21.3544698,-158.0658552 21.3537903,-158.0662242" + + " 21.3532227,-158.0668165 21.3524633,-158.0673915 21.3518558,-158.0741478" + + " 21.3455763,-158.0760433 21.3438376,-158.0776483 21.3423267,-158.0786096" + + " 21.3414713,-158.0792104 21.3408397,-158.0796297 21.3404253,-158.0798026" + + " 21.3402481,-158.0826506 21.3369385,-158.0831127 21.3364014,-158.0834075" + + " 21.3360589,-158.0837122 21.3357062,-158.083788 21.3356184,-158.0851756" + + " 21.3340122,-158.0856134 21.3336045,-158.0860168 21.3333086,-158.0864288" + + " 21.3330528,-158.0869695 21.332773,-158.0875961 21.3325491,-158.0882398" + + " 21.3323812,-158.0887033 21.3323013,-158.089244 21.3322773,-158.0897933" + + " 21.3322773,-158.0904285 21.3323013,-158.0909864 21.3324052,-158.0914756" + + " 21.3325811,-158.0920507 21.332805,-158.0926397 21.3331239,-158.0931267" + + " 21.333463,-158.0936268 21.3339656,-158.093814 21.3342067),(-158.0608129" + + " 21.3660325,-158.0613708 21.3655329,-158.0618214 21.3650933,-158.0621266" + + " 21.3647301,-158.0624056 21.3643304,-158.0626368 21.3639343,-158.0628347" + + " 21.363591,-158.0630142 21.3631108),(-158.0596223 21.3670474,-158.0608129" + + " 21.3660325),(-158.0441757 21.3776379,-158.048071 21.3761154,-158.0488006" + + " 21.3758276,-158.0492727 21.3756118,-158.0498563 21.3753001,-158.0505515" + + " 21.3748685,-158.0511609 21.3744609,-158.0517274 21.3740213,-158.052251" + + " 21.3735977,-158.0526973 21.373198,-158.0563069 21.369968,-158.0596223" + + " 21.3670474),(-158.0435563 21.3778737,-158.0441757 21.3776379),(-158.0324485" + + " 21.3837899,-158.0343467 21.3826132,-158.0383392 21.380405,-158.039385" + + " 21.379744,-158.0402519 21.3792724,-158.0410329 21.3788968,-158.041711" + + " 21.3786011,-158.0426294 21.3782414,-158.0435563 21.3778737),(-158.0320356" + + " 21.3840079,-158.0324485 21.3837899),(-158.023442 21.3888547,-158.0267354" + + " 21.3869747,-158.0277935 21.3863772,-158.028972 21.3857107,-158.0320356" + + " 21.3840079),(-158.0231409 21.3890189,-158.023442 21.3888547),(-158.0191075" + + " 21.390625,-158.0209094 21.3900405,-158.021798 21.3896905,-158.0226534" + + " 21.3892749,-158.0231409 21.3890189),(-158.0165725 21.3914004,-158.0191075" + + " 21.390625),(-158.0098819 21.3961801,-158.0106489 21.3956401,-158.0115243" + + " 21.3948729,-158.0122625 21.3942175,-158.0132581 21.3933305,-158.0139276" + + " 21.3927631,-158.0142967 21.3924594,-158.0148202 21.3921317,-158.0153781" + + " 21.391852,-158.0159103 21.3916362,-158.0165725 21.3914004),(-158.0094038" + + " 21.3965163,-158.0098819 21.3961801),(-158.0000745 21.3993481,-158.0006152" + + " 21.399404,-158.001259 21.39942,-158.001937 21.399404,-158.0025636" + + " 21.3993161,-158.0031215 21.3992282,-158.0036107 21.3991163,-158.0044776" + + " 21.3988926,-158.0052158 21.3986528,-158.0061427 21.3982932,-158.0070611" + + " 21.3978937,-158.0077993 21.3975101,-158.0084001 21.3971584,-158.0094038" + + " 21.3965163),(-157.9995749 21.3992637,-158.0000745 21.3993481),(-157.9785825" + + " 21.3934344,-157.9795867 21.3938659,-157.980445 21.3942016,-157.9821788" + + " 21.3948809,-157.9828483 21.3951765,-157.9836894 21.395648,-157.9841272" + + " 21.3959038,-157.9848911 21.3964152,-157.9854919 21.3968308,-157.9860841" + + " 21.3972144,-157.9866248 21.3975021,-157.9871398 21.3977019,-157.987878" + + " 21.3979336,-157.9888921 21.3981294,-157.9894229 21.3981813,-157.989895" + + " 21.3981813,-157.9907203 21.3980974,-157.991407 21.3980494,-157.9921094" + + " 21.3979896,-157.9927446 21.3979816,-157.9934069 21.398023,-157.9941865" + + " 21.3981494,-157.9954654 21.3984291,-157.9975768 21.3988766,-157.9990639" + + " 21.3991671,-157.9995749 21.3992637),(-157.9620701 21.3912806,-157.9642145" + + " 21.3904694,-157.9646865 21.3903336,-157.9654332 21.3901577,-157.9661232" + + " 21.3900378,-157.9668129 21.3899789,-157.9675876 21.3899579,-157.9683858" + + " 21.3899739,-157.9689266 21.3900299,-157.9695875 21.3901338,-157.9702226" + + " 21.3902776,-157.970832 21.3904614,-157.9713384 21.3906133,-157.9767146" + + " 21.392707,-157.9785825 21.3934344),(-157.9596998 21.3922676,-157.9620701" + + " 21.3912806),(-157.9588428 21.3926072,-157.9596998 21.3922676),(-157.9531852" + + " 21.3931227,-157.9539437 21.3933065,-157.9544973 21.3933845,-157.9550477" + + " 21.3934264,-157.9557344 21.3934024,-157.9563953 21.3933385,-157.957039" + + " 21.3932106,-157.9577771 21.3930268,-157.958438 21.392787,-157.9588428" + + " 21.3926072),(-157.9487134 21.3914924,-157.9514257 21.3924993,-157.9526616" + + " 21.3929549,-157.9531852 21.3931227),(-157.94517 21.3902176,-157.9487134" + + " 21.3914924),(-157.9260741 21.3703845,-157.9255048 21.3715515,-157.9252902" + + " 21.372103,-157.9252044 21.3725267,-157.9251701 21.3731661,-157.9251958" + + " 21.3738774,-157.925316 21.3744449,-157.9254876 21.3749165,-157.9257623" + + " 21.3754999,-157.926037 21.3758676,-157.9268094 21.3768987,-157.9279277" + + " 21.3784371,-157.9288951 21.379776,-157.9311439 21.3827731,-157.9319679" + + " 21.3839,-157.9321653 21.3841797,-157.9325086 21.3845953,-157.9330922" + + " 21.3851787,-157.9335643 21.3855624,-157.934148 21.3859859,-157.9345342" + + " 21.3862097,-157.9349891 21.3864814,-157.9355985 21.3867452,-157.9363023" + + " 21.3870169,-157.9372121 21.3873366,-157.9388171 21.387944,-157.9406295" + + " 21.3885953,-157.94517 21.3902176),(-157.9262296 21.3700398,-157.9260741" + + " 21.3703845),(-157.9271289 21.3680868,-157.9267494 21.3689139,-157.9262296" + + " 21.3700398),(-157.92935 21.3633586,-157.9277266 21.3668181,-157.9271289" + + " 21.3680868),(-157.932281 21.3430995,-157.9326631 21.3438296,-157.9328262" + + " 21.3441814,-157.9330064 21.3446371,-157.9331952 21.3453166,-157.9332982" + + " 21.3459002,-157.9333645 21.3462826,-157.9334098 21.3470753,-157.9333583" + + " 21.3477468,-157.9332897 21.3482265,-157.9325453 21.3518856,-157.9317447" + + " 21.3558207,-157.93144 21.3572618,-157.9311954 21.3584186,-157.9310323" + + " 21.3591541,-157.9308006 21.3599374,-157.9306032 21.360513,-157.9303972" + + " 21.3610565,-157.92935 21.3633586),(-157.9321067 21.3427872,-157.932281" + + " 21.3430995),(-157.9301713 21.3407513,-157.930689 21.3411835,-157.931204" + + " 21.3416711,-157.9316794 21.3422123,-157.9321067 21.3427872),(-157.8880433" + + " 21.3354212,-157.8887053 21.3350056,-157.8892976 21.3347577,-157.889907" + + " 21.3345739,-157.8905078 21.3344539,-157.8908254 21.334414,-157.8912373" + + " 21.33439,-157.8918038 21.334382,-157.8927194 21.3344641,-157.8935977" + + " 21.3345339,-157.8944131 21.3345898,-157.8949281 21.3346458,-157.8957778" + + " 21.3346858,-157.8964473 21.3347337,-157.896988 21.3347897,-157.8977347" + + " 21.3348617,-157.8984986 21.3349256,-157.8991853 21.3350136,-157.9001122" + + " 21.3351495,-157.9023782 21.3355013,-157.9046012 21.335837,-157.9089052" + + " 21.3364906,-157.9210159 21.3382654,-157.9257881 21.338985,-157.9265949" + + " 21.3391289,-157.9274446 21.3393607,-157.9281312 21.3396085,-157.928835" + + " 21.3399283,-157.9294874 21.3402881,-157.9301713 21.3407513),(-157.884067" + + " 21.3378087,-157.8843262 21.337798,-157.8845222 21.3377673,-157.8847344" + + " 21.3377006,-157.8849917 21.3375962,-157.8852568 21.3374482,-157.8880433" + + " 21.3354212),(-157.8834549 21.337632,-157.8835766 21.3376898,-157.8836831" + + " 21.3377293,-157.8837852 21.337763,-157.8839272 21.3377946,-157.884067" + + " 21.3378087),(-157.8779177 21.3359254,-157.8782283 21.3360045,-157.8786184" + + " 21.3360972,-157.879148 21.3362233,-157.8798816 21.3363157,-157.8802768" + + " 21.3363487,-157.8811179 21.3364526,-157.8813425 21.3364889,-157.8817419" + + " 21.3366011,-157.8820432 21.3367175,-157.882462 21.3369177,-157.882755" + + " 21.3371103,-157.8831006 21.337404,-157.8834549 21.337632),(-157.8774238" + + " 21.3357688,-157.8779177 21.3359254),(-157.8699993 21.3303273,-157.8705006" + + " 21.3309361,-157.8708354 21.3312719,-157.8719649 21.3323197,-157.8729297" + + " 21.3332147,-157.873867 21.3339573,-157.8744463 21.3343201,-157.8750358" + + " 21.3346776,-157.8756997 21.3350405,-157.8763352 21.3353138,-157.8765871" + + " 21.3354181,-157.8769582 21.3356123,-157.8774238 21.3357688),(-157.8696388" + + " 21.3298636,-157.8699993 21.3303273),(-157.8676654 21.3269647,-157.8680077" + + " 21.3274554,-157.8696388 21.3298636),(-157.8672534 21.3263891,-157.8676654" + + " 21.3269647),(-157.8657613 21.3245853,-157.8658855 21.3246834,-157.8660063" + + " 21.3247874,-157.8661185 21.3248954,-157.8662269 21.325009,-157.8663387" + + " 21.325136,-157.8664482 21.3252711,-157.8668614 21.3258592,-157.8672534" + + " 21.3263891),(-157.8625422 21.3236073,-157.8627321 21.3236729,-157.8629153" + + " 21.3237268,-157.863111 21.323773,-157.863318 21.3238126,-157.8642807" + + " 21.3239695,-157.8644734 21.3240059,-157.8646852 21.324059,-157.8648726" + + " 21.3241223,-157.8650638 21.3241938,-157.8652474 21.3242762,-157.865433" + + " 21.3243737,-157.8656065 21.3244785,-157.8657613 21.3245853),(-157.8577497" + + " 21.318385,-157.8601337 21.3213251,-157.8610717 21.3225075,-157.8611888" + + " 21.3226469,-157.8613107 21.3227847,-157.8614371 21.3229076,-157.8615734" + + " 21.3230303,-157.8617231 21.3231496,-157.861866 21.3232527,-157.8620194" + + " 21.3233524,-157.862193 21.3234508,-157.8623649 21.3235323,-157.8625422" + + " 21.3236073),(-157.857535 21.3181186,-157.8577497 21.318385),(-157.8527098" + + " 21.3118395,-157.8527841 21.3119802,-157.8528635 21.3121266,-157.8529431" + + " 21.3122691,-157.8530349 21.3124226,-157.8531222 21.3125599,-157.8532171" + + " 21.3127056,-157.8533232 21.3128576,-157.8534206 21.3129927,-157.8535182" + + " 21.3131266,-157.8536302 21.3132727,-157.8552278 21.3152554,-157.8559235" + + " 21.3161187,-157.857535 21.3181186),(-157.8524584 21.3112802,-157.8525154" + + " 21.3114221,-157.8525766 21.3115624,-157.8526387 21.311695,-157.8527098" + + " 21.3118395),(-157.845235 21.304549,-157.8473693 21.3052736,-157.8476942" + + " 21.3053857,-157.8491443 21.3058863,-157.8493537 21.3059624,-157.8495536" + + " 21.306041,-157.849738 21.306128,-157.8499141 21.3062216,-157.8500919" + + " 21.3063316,-157.8502358 21.306437,-157.850372 21.3065471,-157.8504924" + + " 21.3066568,-157.8506296 21.3067891,-157.8507428 21.3069114,-157.850849" + + " 21.3070408,-157.8509506 21.3071733,-157.8510586 21.3073289,-157.8511557" + + " 21.3074802,-157.8512438 21.3076427,-157.8513095 21.3077835,-157.8513766" + + " 21.3079412,-157.8514345 21.3081034,-157.8521655 21.3104222,-157.852293" + + " 21.3108264,-157.8523457 21.3109812,-157.8524016 21.3111335,-157.8524584" + + " 21.3112802),(-157.8396763 21.3026507,-157.8398556 21.3026918,-157.840031" + + " 21.3027429,-157.8402064 21.3028011,-157.8423195 21.3035619,-157.8442855" + + " 21.3042316,-157.845235 21.304549),(-157.8366046 21.3022191,-157.8370683" + + " 21.3022818,-157.8391014 21.3025567,-157.839294 21.3025831,-157.8394858" + + " 21.3026148,-157.8396763 21.3026507),(-157.8214474 21.2947647,-157.8219341" + + " 21.2950513,-157.8231495 21.2957177,-157.8241704 21.2962774,-157.8243481" + + " 21.2963691,-157.8245412 21.2964598,-157.824718 21.2965341,-157.8248975" + + " 21.2966015,-157.8294163 21.2982471,-157.8296205 21.2983233,-157.8298046" + + " 21.2983959,-157.8299944 21.2984818,-157.830185 21.2985748,-157.8303701" + + " 21.2986773,-157.8305703 21.2987983,-157.8320661 21.2997696,-157.8347249" + + " 21.3015078,-157.8348971 21.3016169,-157.8350745 21.3017196,-157.8352586" + + " 21.301813,-157.8354404 21.3018959,-157.8356261 21.3019703,-157.835818" + + " 21.3020374,-157.8360031 21.302093,-157.8362049 21.3021455,-157.8364101" + + " 21.3021884,-157.8366046 21.3022191),(-157.8210282 21.2944178,-157.8212139" + + " 21.2945766,-157.8214474 21.2947647),(-157.8158031 21.2898165,-157.8176218" + + " 21.2909112,-157.8182984 21.2914191,-157.8190411 21.2921377,-157.8195581" + + " 21.2927893,-157.8201032 21.2934761,-157.8203826 21.2937817,-157.8206628" + + " 21.2940749,-157.8210282 21.2944178),(-157.8155037 21.2896406,-157.8158031" + + " 21.2898165),(-157.8142763 21.2889252,-157.8155037 21.2896406),(-157.8120803" + + " 21.287036,-157.8123453 21.287334,-157.8127132 21.2877382,-157.8129056" + + " 21.2879216,-157.8130647 21.2880665,-157.8132762 21.2882329,-157.8136278" + + " 21.288499,-157.8139399 21.288709,-157.8142763 21.2889252),(-157.8026247" + + " 21.2815767,-157.802923 21.2817301,-157.8036063 21.282084,-157.8100483" + + " 21.2853797,-157.8102541 21.2854856,-157.8104603 21.2856021,-157.8106545" + + " 21.2857223,-157.8108344 21.2858429,-157.8110107 21.2859701,-157.8111756" + + " 21.2861008,-157.8113239 21.2862273,-157.8114661 21.286356,-157.8117107" + + " 21.2866267,-157.8120803 21.287036),(-157.8023689 21.2814452,-157.8026247" + + " 21.2815767),(-157.7898518 21.2790207,-157.7905107 21.2791329,-157.7907155" + + " 21.2791607,-157.7909138 21.2791782,-157.7911077 21.2791895,-157.7913211" + + " 21.279189,-157.7915211 21.2791802,-157.7917238 21.2791595,-157.7919242" + + " 21.2791294,-157.7921181 21.2790892,-157.7923012 21.2790418,-157.7928694" + + " 21.278876,-157.793257 21.2787629,-157.793454 21.2787132,-157.7936521" + + " 21.2786687,-157.7938514 21.2786283,-157.7940472 21.2785974,-157.7942416" + + " 21.2785718,-157.7944329 21.2785522,-157.7946564 21.2785377,-157.79488" + + " 21.2785296,-157.7950901 21.2785275,-157.7953063 21.2785327,-157.7955116" + + " 21.2785435,-157.7957064 21.278559,-157.7958976 21.2785808,-157.7960954" + + " 21.2786092,-157.7962945 21.2786432,-157.7964912 21.2786832,-157.7966827" + + " 21.278728,-157.7968837 21.2787801,-157.7970828 21.2788356,-157.7972787" + + " 21.2788977,-157.7974937 21.2789766,-157.7976905 21.2790582,-157.7978878" + + " 21.2791467,-157.7980886 21.2792445,-157.7982826 21.2793437,-157.8023689" + + " 21.2814452),(-157.7835222 21.2783209,-157.7887428 21.278832,-157.7889936" + + " 21.2788595,-157.7892498 21.2789019,-157.7894749 21.2789586,-157.7898518" + + " 21.2790207),(-157.7805411 21.2780102,-157.7810196 21.27806,-157.7835222" + + " 21.2783209),(-157.7797623 21.2779215,-157.7805411 21.2780102))"; @Before public void init() { diff --git a/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialMultiPolygonTest.java b/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialMultiPolygonTest.java index 332680af1f0..b9ddff1bb43 100644 --- a/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialMultiPolygonTest.java +++ b/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialMultiPolygonTest.java @@ -37,7 +37,84 @@ public class LuceneSpatialMultiPolygonTest extends BaseSpatialLuceneTest { private static final String MULTIWKT = - "MULTIPOLYGON(((-159.656175 21.969122,-159.6561467 21.9690575,-159.6557896 21.9681398,-159.6553325 21.9669081,-159.6552805 21.9666414,-159.6552255 21.9657462,-159.655233 21.9657339,-159.6555663 21.9651873,-159.6559767 21.9645571,-159.656648 21.9640088,-159.6578895 21.9630017,-159.6590416 21.9619414,-159.6598896 21.9610959,-159.6604191 21.9601034,-159.6608596 21.9591291,-159.6615639 21.9574598,-159.6621416 21.9559216,-159.6625578 21.9552083,-159.6634363 21.954072,-159.6643206 21.953279,-159.6656085 21.9523019,-159.6659743 21.9516061,-159.666044 21.9515124,-159.666286 21.951219,-159.666366 21.951123,-159.666431 21.951143,-159.667107 21.951324,-159.6676335 21.9521128,-159.668363 21.9526701,-159.6693501 21.9529487,-159.670423 21.9531875,-159.6720537 21.9538244,-159.6743712 21.9543816,-159.6768603 21.9547797,-159.682673 21.955736,-159.685607 21.956101,-159.686706 21.956305,-159.688438 21.956628,-159.690609 21.95701,-159.691179 21.957084,-159.692888 21.957308,-159.693459 21.957383,-159.693193 21.957764,-159.692816 21.958307,-159.692484 21.958961,-159.692275 21.959376,-159.692245 21.959444,-159.6921315 21.9594997,-159.6920045 21.9596087,-159.6919485 21.9596587,-159.6918228 21.9599765,-159.6916513 21.9606401,-159.69152 21.9613,-159.689392 21.961244,-159.682434 21.96101,-159.68116 21.96097,-159.67998 21.96092,-159.679973 21.961287,-159.67997 21.96153,-159.67995 21.96157,-159.67991 21.96163,-159.6797 21.96198,-159.67953 21.96224,-159.679516 21.962261,-159.679327 21.962577,-159.679298 21.962623,-159.679213 21.962765,-159.679185 21.962812,-159.67909 21.96297,-159.679 21.96296,-159.67886 21.96291,-159.67882 21.96293,-159.67881 21.96299,-159.67879 21.96303,-159.67875 21.96308,-159.678736 21.963117,-159.67872 21.96316,-159.678329 21.965107,-159.678196 21.965772,-159.678091 21.965764,-159.678038 21.965764,-159.677566 21.96577,-159.677409 21.965772,-159.677111 21.965312,-159.676705 21.965227,-159.675666 21.965012,-159.67518 21.964613,-159.674748 21.964343,-159.674331 21.964212,-159.674167 21.964397,-159.673531 21.965119,-159.673829 21.9654,-159.674723 21.966246,-159.675022 21.966528,-159.67501 21.966526,-159.674561 21.966493,-159.674455 21.966471,-159.67426 21.966371,-159.673965 21.966322,-159.673892 21.966287,-159.673752 21.966222,-159.673357 21.965997,-159.673056 21.965848,-159.672395 21.965451,-159.672052 21.965187,-159.671556 21.964878,-159.670943 21.964437,-159.670927 21.964427,-159.670488 21.964167,-159.670116 21.963881,-159.670008 21.963726,-159.669847 21.963756,-159.669639 21.963641,-159.669619 21.963625,-159.669537 21.963558,-159.669428 21.963345,-159.669312 21.963149,-159.669161 21.962999,-159.668896 21.962808,-159.668757 21.962714,-159.668585 21.962597,-159.668371 21.962554,-159.668346 21.962561,-159.668271 21.962582,-159.668246 21.962589,-159.668126 21.96261,-159.667978 21.962637,-159.667813 21.962667,-159.667794 21.962707,-159.667743 21.962817,-159.667687 21.962869,-159.667667 21.962889,-159.667544 21.963051,-159.667498 21.963113,-159.667182 21.963533,-159.667164 21.963517,-159.667123 21.963483,-159.666666 21.962815,-159.666483 21.962507,-159.666273 21.962136,-159.666134 21.96189,-159.665974 21.961678,-159.66591 21.961593,-159.665827 21.961498,-159.665662 21.961307,-159.665526 21.961197,-159.665295 21.961061,-159.665284 21.961054,-159.665071 21.961008,-159.665019 21.960996,-159.66493 21.960977,-159.664862 21.960978,-159.66481 21.96098,-159.664735 21.960982,-159.664611 21.961004,-159.664458 21.961114,-159.663927 21.962326,-159.663879 21.962365,-159.663284 21.963659,-159.663055 21.964187,-159.662735 21.964932,-159.662454 21.965314,-159.66234 21.965471,-159.662169 21.965659,-159.66211 21.96578,-159.661744 21.96632,-159.661714 21.966347,-159.661667 21.966502,-159.661514 21.966882,-159.661425 21.967008,-159.661207 21.967416,-159.660888 21.967785,-159.660888 21.967823,-159.660812 21.967912,-159.660688 21.967989,-159.660523 21.968038,-159.660003 21.968105,-159.659318 21.968298,-159.659224 21.968331,-159.658993 21.968458,-159.658781 21.96854,-159.658415 21.9687,-159.658202 21.968755,-159.658126 21.968805,-159.65724 21.969835,-159.657193 21.969895,-159.657241 21.970154,-159.657288 21.970314,-159.657424 21.970606,-159.657453 21.970655,-159.657453 21.970688,-159.657518 21.971041,-159.65753 21.971135,-159.65753 21.971162,-159.657657 21.972474,-159.657928 21.975265,-159.65791 21.975413,-159.658004 21.975645,-159.658123 21.976008,-159.658217 21.976173,-159.658058 21.976151,-159.658041 21.976137,-159.657881 21.976003,-159.657668 21.975854,-159.657595 21.975835,-159.657579 21.975832,-159.657414 21.975827,-159.657426 21.975595,-159.65741 21.97546,-159.657402 21.975386,-159.657242 21.974835,-159.657189 21.974626,-159.657148 21.974439,-159.657139 21.974393,-159.657089 21.974136,-159.657013 21.974063,-159.65701 21.97398,-159.65698 21.97368,-159.656967 21.973491,-159.65695 21.97324,-159.65691 21.97294,-159.65683 21.97241,-159.65681 21.97231,-159.65679 21.97209,-159.656783 21.971781,-159.65678 21.9716,-159.65679 21.97145,-159.65681 21.97134,-159.65682 21.97121,-159.65683 21.97109,-159.65683 21.97086,-159.656815 21.970643,-159.656814 21.970637,-159.6568 21.97043,-159.65673 21.97002,-159.65672 21.96987,-159.65668 21.96975,-159.6566381 21.9696663,-159.65662 21.96963,-159.65657 21.96951,-159.65651 21.96935,-159.65647 21.96922,-159.656426 21.968976,-159.65642 21.96894,-159.65639 21.9687,-159.65634 21.96841,-159.656299 21.968483,-159.656225 21.968618,-159.656209 21.968713,-159.656205 21.96874,-159.656206 21.968797,-159.656207 21.968862,-159.65621 21.968958,-159.656188 21.969057,-159.656175 21.969122)))"; + "MULTIPOLYGON(((-159.656175 21.969122,-159.6561467 21.9690575,-159.6557896" + + " 21.9681398,-159.6553325 21.9669081,-159.6552805 21.9666414,-159.6552255" + + " 21.9657462,-159.655233 21.9657339,-159.6555663 21.9651873,-159.6559767" + + " 21.9645571,-159.656648 21.9640088,-159.6578895 21.9630017,-159.6590416" + + " 21.9619414,-159.6598896 21.9610959,-159.6604191 21.9601034,-159.6608596" + + " 21.9591291,-159.6615639 21.9574598,-159.6621416 21.9559216,-159.6625578" + + " 21.9552083,-159.6634363 21.954072,-159.6643206 21.953279,-159.6656085" + + " 21.9523019,-159.6659743 21.9516061,-159.666044 21.9515124,-159.666286" + + " 21.951219,-159.666366 21.951123,-159.666431 21.951143,-159.667107" + + " 21.951324,-159.6676335 21.9521128,-159.668363 21.9526701,-159.6693501" + + " 21.9529487,-159.670423 21.9531875,-159.6720537 21.9538244,-159.6743712" + + " 21.9543816,-159.6768603 21.9547797,-159.682673 21.955736,-159.685607" + + " 21.956101,-159.686706 21.956305,-159.688438 21.956628,-159.690609" + + " 21.95701,-159.691179 21.957084,-159.692888 21.957308,-159.693459" + + " 21.957383,-159.693193 21.957764,-159.692816 21.958307,-159.692484" + + " 21.958961,-159.692275 21.959376,-159.692245 21.959444,-159.6921315" + + " 21.9594997,-159.6920045 21.9596087,-159.6919485 21.9596587,-159.6918228" + + " 21.9599765,-159.6916513 21.9606401,-159.69152 21.9613,-159.689392" + + " 21.961244,-159.682434 21.96101,-159.68116 21.96097,-159.67998 21.96092,-159.679973" + + " 21.961287,-159.67997 21.96153,-159.67995 21.96157,-159.67991 21.96163,-159.6797" + + " 21.96198,-159.67953 21.96224,-159.679516 21.962261,-159.679327 21.962577,-159.679298" + + " 21.962623,-159.679213 21.962765,-159.679185 21.962812,-159.67909 21.96297,-159.679" + + " 21.96296,-159.67886 21.96291,-159.67882 21.96293,-159.67881 21.96299,-159.67879" + + " 21.96303,-159.67875 21.96308,-159.678736 21.963117,-159.67872 21.96316,-159.678329" + + " 21.965107,-159.678196 21.965772,-159.678091 21.965764,-159.678038" + + " 21.965764,-159.677566 21.96577,-159.677409 21.965772,-159.677111" + + " 21.965312,-159.676705 21.965227,-159.675666 21.965012,-159.67518" + + " 21.964613,-159.674748 21.964343,-159.674331 21.964212,-159.674167" + + " 21.964397,-159.673531 21.965119,-159.673829 21.9654,-159.674723 21.966246,-159.675022" + + " 21.966528,-159.67501 21.966526,-159.674561 21.966493,-159.674455 21.966471,-159.67426" + + " 21.966371,-159.673965 21.966322,-159.673892 21.966287,-159.673752" + + " 21.966222,-159.673357 21.965997,-159.673056 21.965848,-159.672395" + + " 21.965451,-159.672052 21.965187,-159.671556 21.964878,-159.670943" + + " 21.964437,-159.670927 21.964427,-159.670488 21.964167,-159.670116" + + " 21.963881,-159.670008 21.963726,-159.669847 21.963756,-159.669639" + + " 21.963641,-159.669619 21.963625,-159.669537 21.963558,-159.669428" + + " 21.963345,-159.669312 21.963149,-159.669161 21.962999,-159.668896" + + " 21.962808,-159.668757 21.962714,-159.668585 21.962597,-159.668371" + + " 21.962554,-159.668346 21.962561,-159.668271 21.962582,-159.668246" + + " 21.962589,-159.668126 21.96261,-159.667978 21.962637,-159.667813" + + " 21.962667,-159.667794 21.962707,-159.667743 21.962817,-159.667687" + + " 21.962869,-159.667667 21.962889,-159.667544 21.963051,-159.667498" + + " 21.963113,-159.667182 21.963533,-159.667164 21.963517,-159.667123" + + " 21.963483,-159.666666 21.962815,-159.666483 21.962507,-159.666273" + + " 21.962136,-159.666134 21.96189,-159.665974 21.961678,-159.66591 21.961593,-159.665827" + + " 21.961498,-159.665662 21.961307,-159.665526 21.961197,-159.665295" + + " 21.961061,-159.665284 21.961054,-159.665071 21.961008,-159.665019" + + " 21.960996,-159.66493 21.960977,-159.664862 21.960978,-159.66481 21.96098,-159.664735" + + " 21.960982,-159.664611 21.961004,-159.664458 21.961114,-159.663927" + + " 21.962326,-159.663879 21.962365,-159.663284 21.963659,-159.663055" + + " 21.964187,-159.662735 21.964932,-159.662454 21.965314,-159.66234" + + " 21.965471,-159.662169 21.965659,-159.66211 21.96578,-159.661744 21.96632,-159.661714" + + " 21.966347,-159.661667 21.966502,-159.661514 21.966882,-159.661425" + + " 21.967008,-159.661207 21.967416,-159.660888 21.967785,-159.660888" + + " 21.967823,-159.660812 21.967912,-159.660688 21.967989,-159.660523" + + " 21.968038,-159.660003 21.968105,-159.659318 21.968298,-159.659224" + + " 21.968331,-159.658993 21.968458,-159.658781 21.96854,-159.658415 21.9687,-159.658202" + + " 21.968755,-159.658126 21.968805,-159.65724 21.969835,-159.657193" + + " 21.969895,-159.657241 21.970154,-159.657288 21.970314,-159.657424" + + " 21.970606,-159.657453 21.970655,-159.657453 21.970688,-159.657518" + + " 21.971041,-159.65753 21.971135,-159.65753 21.971162,-159.657657 21.972474,-159.657928" + + " 21.975265,-159.65791 21.975413,-159.658004 21.975645,-159.658123" + + " 21.976008,-159.658217 21.976173,-159.658058 21.976151,-159.658041" + + " 21.976137,-159.657881 21.976003,-159.657668 21.975854,-159.657595" + + " 21.975835,-159.657579 21.975832,-159.657414 21.975827,-159.657426" + + " 21.975595,-159.65741 21.97546,-159.657402 21.975386,-159.657242 21.974835,-159.657189" + + " 21.974626,-159.657148 21.974439,-159.657139 21.974393,-159.657089" + + " 21.974136,-159.657013 21.974063,-159.65701 21.97398,-159.65698 21.97368,-159.656967" + + " 21.973491,-159.65695 21.97324,-159.65691 21.97294,-159.65683 21.97241,-159.65681" + + " 21.97231,-159.65679 21.97209,-159.656783 21.971781,-159.65678 21.9716,-159.65679" + + " 21.97145,-159.65681 21.97134,-159.65682 21.97121,-159.65683 21.97109,-159.65683" + + " 21.97086,-159.656815 21.970643,-159.656814 21.970637,-159.6568 21.97043,-159.65673" + + " 21.97002,-159.65672 21.96987,-159.65668 21.96975,-159.6566381 21.9696663,-159.65662" + + " 21.96963,-159.65657 21.96951,-159.65651 21.96935,-159.65647 21.96922,-159.656426" + + " 21.968976,-159.65642 21.96894,-159.65639 21.9687,-159.65634 21.96841,-159.656299" + + " 21.968483,-159.656225 21.968618,-159.656209 21.968713,-159.656205" + + " 21.96874,-159.656206 21.968797,-159.656207 21.968862,-159.65621 21.968958,-159.656188" + + " 21.969057,-159.656175 21.969122)))"; @Before public void initMore() { @@ -63,20 +140,72 @@ public void testMultiPolygonWithoutIndex() throws IOException { protected void queryMultiPolygon() { String query = - "select * from Place where location && 'POLYGON((-162.5537109375 62.11416112594049,-161.87255859375 61.80428390136847,-161.455078125 61.92861247439052,-160.7958984375 62.03183469254472,-160.24658203125 62.196264616146884,-160.64208984375 62.63376960786813,-160.2685546875 63.00513377927512,-159.9609375 63.450509218001095,-159.4775390625 63.860035895395306,-158.97216796875 64.28275952823394,-158.79638671875 64.54844014422517,-158.4228515625 64.77412531292873,-157.43408203125 64.95146502589559,-156.77490234375 64.87693823228864,-155.85205078125 64.79284777557432,-155.41259765625 64.94216049820734,-154.18212890625 64.92354174306496,-154.8193359375 64.76475920891367,-155.56640625 64.65211223878966,-156.51123046875 64.58618480339979,-157.17041015625 64.5578812115091,-157.763671875 64.69910544204765,-158.04931640625 64.33039136366138,-158.26904296875 64.05297838071347,-158.62060546875 63.68524808030714,-159.06005859375 63.361982464431236,-159.45556640625 62.96521201337507,-159.5654296875 62.63376960786813,-159.521484375 62.27814559876582,-160.77392578125 61.53316997618228,-162.53173828125 61.4597705702975,-162.861328125 61.762728830472696,-163.14697265625 62.12443624549497,-162.5537109375 62.11416112594049))' "; + "select * from Place where location && 'POLYGON((-162.5537109375" + + " 62.11416112594049,-161.87255859375 61.80428390136847,-161.455078125" + + " 61.92861247439052,-160.7958984375 62.03183469254472,-160.24658203125" + + " 62.196264616146884,-160.64208984375 62.63376960786813,-160.2685546875" + + " 63.00513377927512,-159.9609375 63.450509218001095,-159.4775390625" + + " 63.860035895395306,-158.97216796875 64.28275952823394,-158.79638671875" + + " 64.54844014422517,-158.4228515625 64.77412531292873,-157.43408203125" + + " 64.95146502589559,-156.77490234375 64.87693823228864,-155.85205078125" + + " 64.79284777557432,-155.41259765625 64.94216049820734,-154.18212890625" + + " 64.92354174306496,-154.8193359375 64.76475920891367,-155.56640625" + + " 64.65211223878966,-156.51123046875 64.58618480339979,-157.17041015625" + + " 64.5578812115091,-157.763671875 64.69910544204765,-158.04931640625" + + " 64.33039136366138,-158.26904296875 64.05297838071347,-158.62060546875" + + " 63.68524808030714,-159.06005859375 63.361982464431236,-159.45556640625" + + " 62.96521201337507,-159.5654296875 62.63376960786813,-159.521484375" + + " 62.27814559876582,-160.77392578125 61.53316997618228,-162.53173828125" + + " 61.4597705702975,-162.861328125 61.762728830472696,-163.14697265625" + + " 62.12443624549497,-162.5537109375 62.11416112594049))' "; List docs = db.query(new OSQLSynchQuery(query)); Assert.assertEquals(docs.size(), 1); query = - "select * from Place where location && 'MULTIPOLYGON(" - + "((-159.78515625 22.126354759919685,-159.510498046875 22.238259929564308,-159.27978515625 22.16705785788614,-159.290771484375 21.9328547363353,-159.466552734375 21.841104749065046,-159.796142578125 21.94304553343818,-159.78515625 22.126354759919685))," - + "((-157.269287109375 21.233062254412808,-157.10174560546875 21.20233749272323,-157.005615234375 21.189533621502626,-156.95343017578125 21.217700673132317,-156.8902587890625 21.194655303138642,-156.8133544921875 21.192094484509035,-156.697998046875 21.174167511794955,-156.7364501953125 21.081937360616084,-156.86004638671875 21.025546284581797,-157.07977294921875 21.066560095381984,-157.247314453125 21.06912308335471,-157.335205078125 21.112687117676757,-157.269287109375 21.18185076626612,-157.269287109375 21.233062254412808))," - + "((-157.06878662109375 20.92296241226858,-157.060546875 20.861378341878538,-157.01934814453125 20.825442642791966,-157.005615234375 20.745840238902257,-156.95068359375 20.72529087399421,-156.84906005859375 20.73556590521865,-156.79962158203125 20.79463378941528,-156.796875 20.84597837877989,-156.86553955078125 20.91013448169267,-156.9671630859375 20.93578924489374,-157.03033447265625 20.93578924489374,-157.06878662109375 20.92296241226858))," - + "((-156.7034912109375 20.925527866647226,-156.67327880859375 21.002471054356725,-156.5936279296875 21.040927787394494,-156.5277099609375 20.981956742832327,-156.5057373046875 20.943484817224167,-156.456298828125 20.92296241226858,-156.37115478515625 20.948614979019347,-156.28326416015625 20.96400440917832,-156.16241455078125 20.89217353537473,-156.04705810546875 20.835710860933656,-155.95367431640625 20.77409105752739,-155.994873046875 20.658486188041294,-156.0992431640625 20.599365240955553,-156.302490234375 20.56336734348637,-156.43707275390625 20.571081893508193,-156.4727783203125 20.658486188041294,-156.47552490234375 20.761250430919663,-156.49749755859375 20.781794909576234,-156.55242919921875 20.756113874762082,-156.66229248046875 20.80747157680652,-156.7034912109375 20.86907773201848,-156.7034912109375 20.925527866647226))," - + "((-156.60736083984375 20.499064283413055,-156.7034912109375 20.4964915991075,-156.71722412109375 20.532505247689578,-156.67327880859375 20.57879605371868,-156.59637451171875 20.609648794045206,-156.5386962890625 20.607077970830282,-156.52496337890625 20.560795740208448,-156.54144287109375 20.514499482150526,-156.5716552734375 20.50678207718623,-156.60736083984375 20.499064283413055))," - + "((-155.928955078125 20.25704380463238,-155.7476806640625 20.2725032501349,-155.58837890625 20.17456745043183,-155.3741455078125 20.12299755620777,-155.2093505859375 19.99916046737026,-154.9786376953125 19.808054128088585,-154.786376953125 19.580493479202527,-154.7259521484375 19.49248592618279,-154.9346923828125 19.331878440818787,-155.3851318359375 19.129599439736833,-155.5224609375 18.932268511298087,-155.7806396484375 18.916679786648565,-155.93994140625 19.062117883514667,-156.0003662109375 19.25929414046391,-156.0113525390625 19.54943746814108,-156.192626953125 19.766703551716972,-155.950927734375 19.921712747556207,-155.9344482421875 20.13847031245115,-155.928955078125 20.25704380463238))" - + ")' "; + "select * from Place where location && 'MULTIPOLYGON(((-159.78515625" + + " 22.126354759919685,-159.510498046875 22.238259929564308,-159.27978515625" + + " 22.16705785788614,-159.290771484375 21.9328547363353,-159.466552734375" + + " 21.841104749065046,-159.796142578125 21.94304553343818,-159.78515625" + + " 22.126354759919685)),((-157.269287109375 21.233062254412808,-157.10174560546875" + + " 21.20233749272323,-157.005615234375 21.189533621502626,-156.95343017578125" + + " 21.217700673132317,-156.8902587890625 21.194655303138642,-156.8133544921875" + + " 21.192094484509035,-156.697998046875 21.174167511794955,-156.7364501953125" + + " 21.081937360616084,-156.86004638671875 21.025546284581797,-157.07977294921875" + + " 21.066560095381984,-157.247314453125 21.06912308335471,-157.335205078125" + + " 21.112687117676757,-157.269287109375 21.18185076626612,-157.269287109375" + + " 21.233062254412808)),((-157.06878662109375 20.92296241226858,-157.060546875" + + " 20.861378341878538,-157.01934814453125 20.825442642791966,-157.005615234375" + + " 20.745840238902257,-156.95068359375 20.72529087399421,-156.84906005859375" + + " 20.73556590521865,-156.79962158203125 20.79463378941528,-156.796875" + + " 20.84597837877989,-156.86553955078125 20.91013448169267,-156.9671630859375" + + " 20.93578924489374,-157.03033447265625 20.93578924489374,-157.06878662109375" + + " 20.92296241226858)),((-156.7034912109375 20.925527866647226,-156.67327880859375" + + " 21.002471054356725,-156.5936279296875 21.040927787394494,-156.5277099609375" + + " 20.981956742832327,-156.5057373046875 20.943484817224167,-156.456298828125" + + " 20.92296241226858,-156.37115478515625 20.948614979019347,-156.28326416015625" + + " 20.96400440917832,-156.16241455078125 20.89217353537473,-156.04705810546875" + + " 20.835710860933656,-155.95367431640625 20.77409105752739,-155.994873046875" + + " 20.658486188041294,-156.0992431640625 20.599365240955553,-156.302490234375" + + " 20.56336734348637,-156.43707275390625 20.571081893508193,-156.4727783203125" + + " 20.658486188041294,-156.47552490234375 20.761250430919663,-156.49749755859375" + + " 20.781794909576234,-156.55242919921875 20.756113874762082,-156.66229248046875" + + " 20.80747157680652,-156.7034912109375 20.86907773201848,-156.7034912109375" + + " 20.925527866647226)),((-156.60736083984375 20.499064283413055,-156.7034912109375" + + " 20.4964915991075,-156.71722412109375 20.532505247689578,-156.67327880859375" + + " 20.57879605371868,-156.59637451171875 20.609648794045206,-156.5386962890625" + + " 20.607077970830282,-156.52496337890625 20.560795740208448,-156.54144287109375" + + " 20.514499482150526,-156.5716552734375 20.50678207718623,-156.60736083984375" + + " 20.499064283413055)),((-155.928955078125 20.25704380463238,-155.7476806640625" + + " 20.2725032501349,-155.58837890625 20.17456745043183,-155.3741455078125" + + " 20.12299755620777,-155.2093505859375 19.99916046737026,-154.9786376953125" + + " 19.808054128088585,-154.786376953125 19.580493479202527,-154.7259521484375" + + " 19.49248592618279,-154.9346923828125 19.331878440818787,-155.3851318359375" + + " 19.129599439736833,-155.5224609375 18.932268511298087,-155.7806396484375" + + " 18.916679786648565,-155.93994140625 19.062117883514667,-156.0003662109375" + + " 19.25929414046391,-156.0113525390625 19.54943746814108,-156.192626953125" + + " 19.766703551716972,-155.950927734375 19.921712747556207,-155.9344482421875" + + " 20.13847031245115,-155.928955078125 20.25704380463238)))' "; docs = db.query(new OSQLSynchQuery(query)); Assert.assertEquals(docs.size(), 1); diff --git a/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialPointTest.java b/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialPointTest.java index e9922262953..4bea89cb2ba 100755 --- a/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialPointTest.java +++ b/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialPointTest.java @@ -87,27 +87,32 @@ public void testIndexingPoint() { protected void queryPoint() { // TODO remove = true when parser will support index function without expression String query = - "select * from City where ST_WITHIN(location,{ 'shape' : { 'type' : 'ORectangle' , 'coordinates' : [12.314015,41.8262816,12.6605063,41.963125]} })" - + " = true"; + "select * from City where ST_WITHIN(location,{ 'shape' : { 'type' : 'ORectangle' ," + + " 'coordinates' : [12.314015,41.8262816,12.6605063,41.963125]} }) = true"; OResultSet docs = db.query(query); Assert.assertEquals(1, docs.stream().count()); query = - "select * from City where ST_WITHIN(location,'POLYGON ((12.314015 41.8262816, 12.314015 41.963125, 12.6605063 41.963125, 12.6605063 41.8262816, 12.314015 41.8262816))')" - + " = true"; + "select * from City where ST_WITHIN(location,'POLYGON ((12.314015 41.8262816, 12.314015" + + " 41.963125, 12.6605063 41.963125, 12.6605063 41.8262816, 12.314015 41.8262816))') =" + + " true"; docs = db.query(query); Assert.assertEquals(1, docs.stream().count()); query = - "select * from City where ST_WITHIN(location,ST_GeomFromText('POLYGON ((12.314015 41.8262816, 12.314015 41.963125, 12.6605063 41.963125, 12.6605063 41.8262816, 12.314015 41.8262816))'))" - + " = true"; + "select * from City where ST_WITHIN(location,ST_GeomFromText('POLYGON ((12.314015" + + " 41.8262816, 12.314015 41.963125, 12.6605063 41.963125, 12.6605063 41.8262816," + + " 12.314015 41.8262816))')) = true"; docs = db.query(query); Assert.assertEquals(1, docs.stream().count()); query = - "select * from City where location && 'LINESTRING(-160.06393432617188 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594 21.787556698550834)' "; + "select * from City where location && 'LINESTRING(-160.06393432617188" + + " 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375" + + " 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594" + + " 21.787556698550834)' "; List old = db.query(new OSQLSynchQuery(query)); Assert.assertEquals(1, old.size()); @@ -121,7 +126,8 @@ public void testOldNearQuery() { protected void queryOldNear() { String query = - "select *,$distance from Place where [latitude,longitude,$spatial] NEAR [41.893056,12.482778,{\"maxDistance\": 2}]"; + "select *,$distance from Place where [latitude,longitude,$spatial] NEAR" + + " [41.893056,12.482778,{\"maxDistance\": 2}]"; List docs = db.query(new OSQLSynchQuery(query)); Assert.assertEquals(1, docs.size()); diff --git a/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialQueryIntegrationTest.java b/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialQueryIntegrationTest.java index 80251ce91a1..3dfdc4e986f 100755 --- a/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialQueryIntegrationTest.java +++ b/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialQueryIntegrationTest.java @@ -36,42 +36,49 @@ public void testIssueGH9105() { db.command("create property POI.name STRING").close(); db.command("create property POI.location EMBEDDED OPoint").close(); db.command( - "insert into POI(name, location) values(\"zeropoint\", St_GeomFromText(\"Point(0 0)\"))") + "insert into POI(name, location) values(\"zeropoint\", St_GeomFromText(\"Point(0" + + " 0)\"))") .close(); db.command( - "insert into Country(name, geometry) values(\"zeroland\", St_GeomFromText(\"MultiPolygon(((1 1, 1 -1, -1 -1, -1 1, 1 1)))\"))") + "insert into Country(name, geometry) values(\"zeroland\"," + + " St_GeomFromText(\"MultiPolygon(((1 1, 1 -1, -1 -1, -1 1, 1 1)))\"))") .close(); db.command("CREATE INDEX POI.location ON POI(location) SPATIAL ENGINE LUCENE"); db.command("CREATE INDEX Country.geometry ON Country(geometry) SPATIAL ENGINE LUCENE;"); try (OResultSet resultSet = db.query( - "select name from Country let locations = (select from Poi) where ST_Contains(geometry, $locations[0].location) = true")) { + "select name from Country let locations = (select from Poi) where ST_Contains(geometry," + + " $locations[0].location) = true")) { assertThat(resultSet.stream().count()).isEqualTo(1); } try (OResultSet resultSet = db.query( - "select name from Country where ST_Contains(geometry, (select location from POI)) = true;")) { + "select name from Country where ST_Contains(geometry, (select location from POI)) =" + + " true;")) { assertThat(resultSet.stream().count()).isEqualTo(1); } try (OResultSet resultSet = db.query( - "select name from Country where ST_Contains(geometry, (select name,location from POI)) = true;")) { + "select name from Country where ST_Contains(geometry, (select name,location from POI))" + + " = true;")) { assertThat(resultSet.stream().count()).isEqualTo(0); } db.command( - "insert into POI(name, location) values(\"zeropoint\", St_GeomFromText(\"Point(0 0)\"))") + "insert into POI(name, location) values(\"zeropoint\", St_GeomFromText(\"Point(0" + + " 0)\"))") .close(); try (OResultSet resultSet = db.query( - "select name from Country where ST_Contains(geometry, (select location from POI)) = true;")) { + "select name from Country where ST_Contains(geometry, (select location from POI)) =" + + " true;")) { Assert.fail("It should throw an exception"); } catch (Exception e) { @@ -82,7 +89,8 @@ public void testIssueGH9105() { try (OResultSet resultSet = db.query( - "select name from Country where ST_Contains(geometry, (select location from POI)) = true;")) { + "select name from Country where ST_Contains(geometry, (select location from POI)) =" + + " true;")) { assertThat(resultSet.stream().count()).isEqualTo(0); } diff --git a/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialQueryTest.java b/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialQueryTest.java index 2e7ab0bf489..99214083de4 100755 --- a/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialQueryTest.java +++ b/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialQueryTest.java @@ -136,7 +136,8 @@ public void run() { public void testNearQuery() { String query = - "select *,$distance from Place where [latitude,longitude,$spatial] NEAR [41.893056,12.482778,{\"maxDistance\": 0.5}]"; + "select *,$distance from Place where [latitude,longitude,$spatial] NEAR" + + " [41.893056,12.482778,{\"maxDistance\": 0.5}]"; OResultSet docs = db.query(query); Assert.assertTrue(docs.hasNext()); @@ -153,7 +154,8 @@ public void testNearQuery() { @Ignore public void testWithinQuery() { String query = - "select * from Place where [latitude,longitude] WITHIN [[51.507222,-0.1275],[55.507222,-0.1275]]"; + "select * from Place where [latitude,longitude] WITHIN" + + " [[51.507222,-0.1275],[55.507222,-0.1275]]"; OResultSet docs = db.query(query); Assert.assertEquals(238, docs.stream().count()); } diff --git a/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialTxPointTest.java b/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialTxPointTest.java index 7277abfcb2d..7163f615fd4 100644 --- a/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialTxPointTest.java +++ b/lucene/src/test/java/com/orientechnologies/spatial/LuceneSpatialTxPointTest.java @@ -84,8 +84,8 @@ public void testIndexingTxPoint() { db.save(rome); String query = - "select * from City where ST_WITHIN(location,{ 'shape' : { 'type' : 'ORectangle' , 'coordinates' : [12.314015,41.8262816,12.6605063,41.963125]} })" - + " = true"; + "select * from City where ST_WITHIN(location,{ 'shape' : { 'type' : 'ORectangle' ," + + " 'coordinates' : [12.314015,41.8262816,12.6605063,41.963125]} }) = true"; OResultSet docs = db.query(query); Assert.assertEquals(1, docs.stream().count()); @@ -93,8 +93,8 @@ public void testIndexingTxPoint() { db.rollback(); query = - "select * from City where ST_WITHIN(location,{ 'shape' : { 'type' : 'ORectangle' , 'coordinates' : [12.314015,41.8262816,12.6605063,41.963125]} })" - + " = true"; + "select * from City where ST_WITHIN(location,{ 'shape' : { 'type' : 'ORectangle' ," + + " 'coordinates' : [12.314015,41.8262816,12.6605063,41.963125]} }) = true"; docs = db.query(query); Assert.assertEquals(0, docs.stream().count()); @@ -116,8 +116,8 @@ public void testIndexingUpdateTxPoint() { db.commit(); String query = - "select * from City where ST_WITHIN(location,{ 'shape' : { 'type' : 'ORectangle' , 'coordinates' : [12.314015,41.8262816,12.6605063,41.963125]} })" - + " = true"; + "select * from City where ST_WITHIN(location,{ 'shape' : { 'type' : 'ORectangle' ," + + " 'coordinates' : [12.314015,41.8262816,12.6605063,41.963125]} }) = true"; OResultSet docs = db.query(query); Assert.assertEquals(1, docs.stream().count()); diff --git a/lucene/src/test/java/com/orientechnologies/spatial/LuceneTransactionGeoQueryTest.java b/lucene/src/test/java/com/orientechnologies/spatial/LuceneTransactionGeoQueryTest.java index e2f4035af72..fc16d324ef1 100644 --- a/lucene/src/test/java/com/orientechnologies/spatial/LuceneTransactionGeoQueryTest.java +++ b/lucene/src/test/java/com/orientechnologies/spatial/LuceneTransactionGeoQueryTest.java @@ -68,14 +68,20 @@ public void testPointTransactionRollBack() { db.save(rome); db.save(london); String query = - "select * from City where location && 'LINESTRING(-160.06393432617188 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594 21.787556698550834)' "; + "select * from City where location && 'LINESTRING(-160.06393432617188" + + " 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375" + + " 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594" + + " 21.787556698550834)' "; List docs = db.query(new OSQLSynchQuery(query)); Assert.assertEquals(1, docs.size()); Assert.assertEquals(3, idx.getInternal().size()); db.rollback(); query = - "select * from City where location && 'LINESTRING(-160.06393432617188 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594 21.787556698550834)' "; + "select * from City where location && 'LINESTRING(-160.06393432617188" + + " 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375" + + " 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594" + + " 21.787556698550834)' "; docs = db.query(new OSQLSynchQuery(query)); Assert.assertEquals(0, docs.size()); Assert.assertEquals(0, idx.getInternal().size()); @@ -114,7 +120,10 @@ public void testPointTransactionUpdate() { db.commit(); String query = - "select * from City where location && 'LINESTRING(-160.06393432617188 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594 21.787556698550834)' "; + "select * from City where location && 'LINESTRING(-160.06393432617188" + + " 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375" + + " 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594" + + " 21.787556698550834)' "; List docs = db.query(new OSQLSynchQuery(query)); Assert.assertEquals(0, docs.size()); Assert.assertEquals(1, idx.getInternal().size()); @@ -124,7 +133,10 @@ public void testPointTransactionUpdate() { db.command("update City set location = ST_GeomFromText('" + PWKT + "')").close(); query = - "select * from City where location && 'LINESTRING(-160.06393432617188 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594 21.787556698550834)' "; + "select * from City where location && 'LINESTRING(-160.06393432617188" + + " 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375" + + " 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594" + + " 21.787556698550834)' "; docs = db.query(new OSQLSynchQuery(query)); Assert.assertEquals(1, docs.size()); Assert.assertEquals(1, idx.getInternal().size()); @@ -132,7 +144,10 @@ public void testPointTransactionUpdate() { db.commit(); query = - "select * from City where location && 'LINESTRING(-160.06393432617188 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594 21.787556698550834)' "; + "select * from City where location && 'LINESTRING(-160.06393432617188" + + " 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375" + + " 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594" + + " 21.787556698550834)' "; docs = db.query(new OSQLSynchQuery(query)); Assert.assertEquals(1, docs.size()); Assert.assertEquals(1, idx.getInternal().size()); diff --git a/lucene/src/test/java/com/orientechnologies/spatial/functions/LuceneSpatialContainsTest.java b/lucene/src/test/java/com/orientechnologies/spatial/functions/LuceneSpatialContainsTest.java index 9df9be5d505..53ff6b7338a 100644 --- a/lucene/src/test/java/com/orientechnologies/spatial/functions/LuceneSpatialContainsTest.java +++ b/lucene/src/test/java/com/orientechnologies/spatial/functions/LuceneSpatialContainsTest.java @@ -29,7 +29,10 @@ public void testContainsNoIndex() { OResultSet execute = db.command( - "select ST_Contains(smallc,smallc) as smallinsmall,ST_Contains(smallc, bigc) As smallinbig, ST_Contains(bigc,smallc) As biginsmall from (SELECT ST_Buffer(ST_GeomFromText('POINT(50 50)'), 20) As smallc,ST_Buffer(ST_GeomFromText('POINT(50 50)'), 40) As bigc)"); + "select ST_Contains(smallc,smallc) as smallinsmall,ST_Contains(smallc, bigc) As" + + " smallinbig, ST_Contains(bigc,smallc) As biginsmall from (SELECT" + + " ST_Buffer(ST_GeomFromText('POINT(50 50)'), 20) As" + + " smallc,ST_Buffer(ST_GeomFromText('POINT(50 50)'), 40) As bigc)"); OResult next = execute.next(); Assert.assertTrue(next.getProperty("smallinsmall")); @@ -56,7 +59,8 @@ public void testContainsIndex() { execute = db.command( - "SELECT from Polygon where ST_Contains(geometry, ST_Buffer(ST_GeomFromText('POINT(50 50)'), 30)) = true"); + "SELECT from Polygon where ST_Contains(geometry, ST_Buffer(ST_GeomFromText('POINT(50" + + " 50)'), 30)) = true"); Assert.assertEquals(1, execute.stream().count()); } @@ -68,10 +72,12 @@ public void testContainsIndex_GeometryCollection() { db.command("create property TestInsert.geometry EMBEDDED OGeometryCollection").close(); db.command( - "insert into TestInsert set geometry = {'@type':'d','@class':'OGeometryCollection','geometries':[{'@type':'d','@class':'OPolygon','coordinates':[[[0,0],[10,0],[10,10],[0,10],[0,0]]]}]}") + "insert into TestInsert set geometry =" + + " {'@type':'d','@class':'OGeometryCollection','geometries':[{'@type':'d','@class':'OPolygon','coordinates':[[[0,0],[10,0],[10,10],[0,10],[0,0]]]}]}") .close(); db.command( - "insert into TestInsert set geometry = {'@type':'d','@class':'OGeometryCollection','geometries':[{'@type':'d','@class':'OPolygon','coordinates':[[[11,11],[21,11],[21,21],[11,21],[11,11]]]}]}") + "insert into TestInsert set geometry =" + + " {'@type':'d','@class':'OGeometryCollection','geometries':[{'@type':'d','@class':'OPolygon','coordinates':[[[11,11],[21,11],[21,21],[11,21],[11,11]]]}]}") .close(); db.command("create index TestInsert.geometry on TestInsert (geometry) SPATIAL engine lucene") diff --git a/lucene/src/test/java/com/orientechnologies/spatial/functions/LuceneSpatialDWithinTest.java b/lucene/src/test/java/com/orientechnologies/spatial/functions/LuceneSpatialDWithinTest.java index f15fe560ed4..73e5b905722 100644 --- a/lucene/src/test/java/com/orientechnologies/spatial/functions/LuceneSpatialDWithinTest.java +++ b/lucene/src/test/java/com/orientechnologies/spatial/functions/LuceneSpatialDWithinTest.java @@ -29,7 +29,8 @@ public void testDWithinNoIndex() { OResultSet execute = db.query( - "SELECT ST_DWithin(ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))'), ST_GeomFromText('POLYGON((12 0, 14 0, 14 6, 12 6, 12 0))'), 2.0d) as distance"); + "SELECT ST_DWithin(ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))')," + + " ST_GeomFromText('POLYGON((12 0, 14 0, 14 6, 12 6, 12 0))'), 2.0d) as distance"); OResult next = execute.next(); @@ -46,20 +47,23 @@ public void testWithinIndex() { db.command("create property Polygon.geometry EMBEDDED OPolygon").close(); db.command( - "insert into Polygon set geometry = ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))')") + "insert into Polygon set geometry = ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0" + + " 0))')") .close(); db.command("create index Polygon.g on Polygon (geometry) SPATIAL engine lucene").close(); OResultSet execute = db.query( - "SELECT from Polygon where ST_DWithin(geometry, ST_GeomFromText('POLYGON((12 0, 14 0, 14 6, 12 6, 12 0))'), 2.0) = true"); + "SELECT from Polygon where ST_DWithin(geometry, ST_GeomFromText('POLYGON((12 0, 14 0," + + " 14 6, 12 6, 12 0))'), 2.0) = true"); Assert.assertEquals(1, execute.stream().count()); OResultSet resultSet = db.query( - "SELECT from Polygon where ST_DWithin(geometry, ST_GeomFromText('POLYGON((12 0, 14 0, 14 6, 12 6, 12 0))'), 2.0) = true"); + "SELECT from Polygon where ST_DWithin(geometry, ST_GeomFromText('POLYGON((12 0, 14 0," + + " 14 6, 12 6, 12 0))'), 2.0) = true"); // Assert.assertEquals(1, resultSet.estimateSize()); diff --git a/lucene/src/test/java/com/orientechnologies/spatial/functions/LuceneSpatialDistanceSphereTest.java b/lucene/src/test/java/com/orientechnologies/spatial/functions/LuceneSpatialDistanceSphereTest.java index adb425dc99d..231edf7942a 100644 --- a/lucene/src/test/java/com/orientechnologies/spatial/functions/LuceneSpatialDistanceSphereTest.java +++ b/lucene/src/test/java/com/orientechnologies/spatial/functions/LuceneSpatialDistanceSphereTest.java @@ -32,8 +32,12 @@ public void testDistanceSphereNoIndex() { OResultSet execute = db.command( - "select ST_Distance(ST_GEOMFROMTEXT('POINT(12.4662748 41.8914114)'),ST_GEOMFROMTEXT('POINT(12.4664632 41.8904382)')) as distanceDeg, \n" - + "ST_Distance_Sphere(ST_GEOMFROMTEXT('POINT(12.4662748 41.8914114)'),ST_GEOMFROMTEXT('POINT(12.4664632 41.8904382)')) as distanceMeter"); + "select ST_Distance(ST_GEOMFROMTEXT('POINT(12.4662748" + + " 41.8914114)'),ST_GEOMFROMTEXT('POINT(12.4664632 41.8904382)')) as distanceDeg," + + " \n" + + "ST_Distance_Sphere(ST_GEOMFROMTEXT('POINT(12.4662748" + + " 41.8914114)'),ST_GEOMFROMTEXT('POINT(12.4664632 41.8904382)')) as" + + " distanceMeter"); OResult next = execute.next(); @@ -59,25 +63,30 @@ public void testWithinIndex() { db.command("create property Place.location EMBEDDED OPoint").close(); db.command( - "insert into Place set name = 'Dar Poeta',location = ST_GeomFromText('POINT(12.4684635 41.8914114)')") + "insert into Place set name = 'Dar Poeta',location = ST_GeomFromText('POINT(12.4684635" + + " 41.8914114)')") .close(); db.command( - "insert into Place set name = 'Antilia Pub',location = ST_GeomFromText('POINT(12.4686519 41.890438)')") + "insert into Place set name = 'Antilia Pub',location =" + + " ST_GeomFromText('POINT(12.4686519 41.890438)')") .close(); db.command( - "insert into Place set name = 'Museo Di Roma in Trastevere',location = ST_GeomFromText('POINT(12.4689762 41.8898916)')") + "insert into Place set name = 'Museo Di Roma in Trastevere',location =" + + " ST_GeomFromText('POINT(12.4689762 41.8898916)')") .close(); db.command("create index Place.l on Place (location) SPATIAL engine lucene").close(); OResultSet execute = db.command( - "SELECT from Place where ST_Distance_Sphere(location, ST_GeomFromText('POINT(12.468933 41.890303)')) < 50"); + "SELECT from Place where ST_Distance_Sphere(location, ST_GeomFromText('POINT(12.468933" + + " 41.890303)')) < 50"); Assert.assertEquals(2, execute.stream().count()); execute = db.command( - "SELECT from Place where ST_Distance_Sphere(location, ST_GeomFromText('POINT(12.468933 41.890303)')) > 50"); + "SELECT from Place where ST_Distance_Sphere(location, ST_GeomFromText('POINT(12.468933" + + " 41.890303)')) > 50"); Assert.assertEquals(1, execute.stream().count()); } @@ -90,25 +99,30 @@ public void testDistanceProjection() { db.command("create property Restaurant.location EMBEDDED OPoint").close(); db.command( - "INSERT INTO Restaurant SET name = 'London', location = St_GeomFromText(\"POINT (-0.1277583 51.5073509)\")") + "INSERT INTO Restaurant SET name = 'London', location = St_GeomFromText(\"POINT" + + " (-0.1277583 51.5073509)\")") .close(); db.command( - "INSERT INTO Restaurant SET name = 'Trafalgar', location = St_GeomFromText(\"POINT (-0.1280688 51.5080388)\")") + "INSERT INTO Restaurant SET name = 'Trafalgar', location = St_GeomFromText(\"POINT" + + " (-0.1280688 51.5080388)\")") .close(); db.command( - "INSERT INTO Restaurant SET name = 'Lambeth North Station', location = St_GeomFromText(\"POINT (-0.1120681 51.4989103)\")") + "INSERT INTO Restaurant SET name = 'Lambeth North Station', location =" + + " St_GeomFromText(\"POINT (-0.1120681 51.4989103)\")") .close(); db.command( - "INSERT INTO Restaurant SET name = 'Montreal', location = St_GeomFromText(\"POINT (-73.567256 45.5016889)\")") + "INSERT INTO Restaurant SET name = 'Montreal', location = St_GeomFromText(\"POINT" + + " (-73.567256 45.5016889)\")") .close(); db.command("CREATE INDEX bla ON Restaurant (location) SPATIAL ENGINE LUCENE;\n").close(); List execute = db .query( - "SELECT ST_Distance_Sphere(location, St_GeomFromText(\"POINT (-0.1277583 51.5073509)\")) as dist from Restaurant;") + "SELECT ST_Distance_Sphere(location, St_GeomFromText(\"POINT (-0.1277583" + + " 51.5073509)\")) as dist from Restaurant;") .stream() .collect(Collectors.toList()); @@ -119,7 +133,8 @@ public void testDistanceProjection() { public void testNullObject() { OResultSet execute = db.command( - "select ST_Distance({ locationCoordinates: null },ST_GEOMFROMTEXT('POINT(12.4664632 41.8904382)')) as distanceMeter"); + "select ST_Distance({ locationCoordinates: null },ST_GEOMFROMTEXT('POINT(12.4664632" + + " 41.8904382)')) as distanceMeter"); OResult next = execute.next(); Assert.assertNull(next.getProperty("distanceMeter")); @@ -131,7 +146,8 @@ public void testNullObject() { public void testSphereNullObject() { OResultSet execute = db.command( - "select ST_Distance_Sphere({ locationCoordinates: null },ST_GEOMFROMTEXT('POINT(12.4664632 41.8904382)')) as distanceMeter"); + "select ST_Distance_Sphere({ locationCoordinates: null" + + " },ST_GEOMFROMTEXT('POINT(12.4664632 41.8904382)')) as distanceMeter"); OResult next = execute.next(); Assert.assertNull(next.getProperty("distanceMeter")); diff --git a/lucene/src/test/java/com/orientechnologies/spatial/functions/LuceneSpatialMiscFunctionsTest.java b/lucene/src/test/java/com/orientechnologies/spatial/functions/LuceneSpatialMiscFunctionsTest.java index 94cad0896f9..7535bd74714 100644 --- a/lucene/src/test/java/com/orientechnologies/spatial/functions/LuceneSpatialMiscFunctionsTest.java +++ b/lucene/src/test/java/com/orientechnologies/spatial/functions/LuceneSpatialMiscFunctionsTest.java @@ -39,7 +39,8 @@ public void testStEquals() { OResultSet execute = db.query( - "SELECT ST_Equals(ST_GeomFromText('LINESTRING(0 0, 10 10)'), ST_GeomFromText('LINESTRING(0 0, 5 5, 10 10)')) as ST_Equals"); + "SELECT ST_Equals(ST_GeomFromText('LINESTRING(0 0, 10 10)')," + + " ST_GeomFromText('LINESTRING(0 0, 5 5, 10 10)')) as ST_Equals"); OResult next = execute.next(); Assert.assertEquals(next.getProperty("ST_Equals"), true); execute.close(); @@ -50,7 +51,8 @@ public void testStEqualsPoint() { OResultSet execute = db.query( - "select ST_Equals(ST_GeomFromText('POINT (55.78639 37.58378)'), ST_GeomFromText('POINT (55.78639 37.58378)')) as ST_Equals"); + "select ST_Equals(ST_GeomFromText('POINT (55.78639 37.58378)'), ST_GeomFromText('POINT" + + " (55.78639 37.58378)')) as ST_Equals"); OResult next = execute.next(); Assert.assertEquals(next.getProperty("ST_Equals"), true); execute.close(); @@ -61,7 +63,8 @@ public void testStWithinPoint() { OResultSet execute = db.query( - "select ST_Within(ST_GeomFromText('POINT (55.78639 37.58378)'), ST_GeomFromText('POINT (55.78639 37.58378)')) as ST_Within"); + "select ST_Within(ST_GeomFromText('POINT (55.78639 37.58378)'), ST_GeomFromText('POINT" + + " (55.78639 37.58378)')) as ST_Within"); OResult next = execute.next(); Assert.assertEquals(next.getProperty("ST_Within"), true); execute.close(); @@ -72,7 +75,8 @@ public void testStContainsPoint() { OResultSet execute = db.query( - "select ST_Contains(ST_GeomFromText('POINT (55.78639 37.58378)'), ST_GeomFromText('POINT (55.78639 37.58378)')) as ST_Contains"); + "select ST_Contains(ST_GeomFromText('POINT (55.78639 37.58378)')," + + " ST_GeomFromText('POINT (55.78639 37.58378)')) as ST_Contains"); OResult next = execute.next(); Assert.assertEquals(next.getProperty("ST_Contains"), true); execute.close(); @@ -161,7 +165,8 @@ public void testBuffer() { execute = db.query( - "SELECT ST_Buffer(ST_GeomFromText('LINESTRING(0 0,75 75,75 0)'), 10, { 'endCap' : 'square' }) as buffer;"); + "SELECT ST_Buffer(ST_GeomFromText('LINESTRING(0 0,75 75,75 0)'), 10, { 'endCap' :" + + " 'square' }) as buffer;"); next = execute.next(); execute.close(); // Assert.assertEquals(next.field("ST_AsText"), @@ -499,7 +504,9 @@ public void testDistance() { OResultSet execute = db.query( - "SELECT ST_Distance(ST_GeomFromText('POINT(-72.1235 42.3521)'),ST_GeomFromText('LINESTRING(-72.1260 42.45, -72.123 42.1546)')) as ST_Distance"); + "SELECT ST_Distance(ST_GeomFromText('POINT(-72.1235" + + " 42.3521)'),ST_GeomFromText('LINESTRING(-72.1260 42.45, -72.123 42.1546)')) as" + + " ST_Distance"); OResult next = execute.next(); execute.close(); // Assert.assertEquals(next.field("ST_Distance"), 0.0015056772638228177); @@ -507,7 +514,8 @@ public void testDistance() { execute = db.query( - "SELECT ST_Distance( ST_GeomFromText('LINESTRING(13.45 52.47,13.46 52.48)'), ST_GeomFromText('LINESTRING(13.00 52.00,13.1 52.2)')) as ST_Distance"); + "SELECT ST_Distance( ST_GeomFromText('LINESTRING(13.45 52.47,13.46 52.48)')," + + " ST_GeomFromText('LINESTRING(13.00 52.00,13.1 52.2)')) as ST_Distance"); next = execute.next(); execute.close(); diff --git a/lucene/src/test/java/com/orientechnologies/spatial/functions/LuceneSpatialWithinTest.java b/lucene/src/test/java/com/orientechnologies/spatial/functions/LuceneSpatialWithinTest.java index 3dd7c0dab90..d06a546ae0e 100644 --- a/lucene/src/test/java/com/orientechnologies/spatial/functions/LuceneSpatialWithinTest.java +++ b/lucene/src/test/java/com/orientechnologies/spatial/functions/LuceneSpatialWithinTest.java @@ -31,8 +31,10 @@ public void testWithinNoIndex() { OResultSet execute = db.query( - "select ST_Within(smallc,smallc) as smallinsmall,ST_Within(smallc, bigc) As smallinbig, ST_Within(bigc,smallc) As biginsmall " - + "from (SELECT ST_Buffer(ST_GeomFromText('POINT(50 50)'), 20) As smallc,ST_Buffer(ST_GeomFromText('POINT(50 50)'), 40) As bigc)"); + "select ST_Within(smallc,smallc) as smallinsmall,ST_Within(smallc, bigc) As smallinbig," + + " ST_Within(bigc,smallc) As biginsmall from (SELECT" + + " ST_Buffer(ST_GeomFromText('POINT(50 50)'), 20) As" + + " smallc,ST_Buffer(ST_GeomFromText('POINT(50 50)'), 40) As bigc)"); OResult next = execute.next(); Assert.assertEquals(next.getProperty("smallinsmall"), true); @@ -54,13 +56,15 @@ public void testWithinIndex() { db.command("create index Polygon.g on Polygon (geometry) SPATIAL engine lucene").close(); OResultSet execute = db.query( - "SELECT from Polygon where ST_Within(geometry, ST_Buffer(ST_GeomFromText('POINT(50 50)'), 50)) = true"); + "SELECT from Polygon where ST_Within(geometry, ST_Buffer(ST_GeomFromText('POINT(50" + + " 50)'), 50)) = true"); Assert.assertEquals(execute.stream().count(), 2); execute = db.query( - "SELECT from Polygon where ST_Within(geometry, ST_Buffer(ST_GeomFromText('POINT(50 50)'), 30)) = true"); + "SELECT from Polygon where ST_Within(geometry, ST_Buffer(ST_GeomFromText('POINT(50" + + " 50)'), 30)) = true"); Assert.assertEquals(execute.stream().count(), 1); } @@ -76,13 +80,15 @@ public void testWithinNewExecutor() throws Exception { db.command("create index Polygon.g on Polygon(geometry) SPATIAL ENGINE LUCENE"); OResultSet execute = db.query( - "SELECT from Polygon where ST_Within(geometry, ST_Buffer(ST_GeomFromText('POINT(50 50)'), 50)) = true"); + "SELECT from Polygon where ST_Within(geometry, ST_Buffer(ST_GeomFromText('POINT(50" + + " 50)'), 50)) = true"); assertThat(execute).hasSize(2); execute = db.query( - "SELECT from Polygon where ST_Within(geometry, ST_Buffer(ST_GeomFromText('POINT(50 50)'), 30)) = true"); + "SELECT from Polygon where ST_Within(geometry, ST_Buffer(ST_GeomFromText('POINT(50" + + " 50)'), 30)) = true"); assertThat(execute).hasSize(1); } diff --git a/lucene/src/test/java/com/orientechnologies/spatial/sandbox/LuceneGeoTest.java b/lucene/src/test/java/com/orientechnologies/spatial/sandbox/LuceneGeoTest.java index 578f8d99976..5989a0da392 100644 --- a/lucene/src/test/java/com/orientechnologies/spatial/sandbox/LuceneGeoTest.java +++ b/lucene/src/test/java/com/orientechnologies/spatial/sandbox/LuceneGeoTest.java @@ -67,7 +67,17 @@ public void geoIntersectTest() throws IOException, ParseException { JtsSpatialContext.GEO .getWktShapeParser() .parse( - "POLYGON((9.481201171875 47.64885294675266,9.471416473388672 47.65128140482982,9.462661743164062 47.64781214443791,9.449443817138672 47.656947367880335,9.445838928222656 47.66110972448931,9.455795288085938 47.667352637215,9.469013214111328 47.67255449415724,9.477081298828125 47.679142768657066,9.490299224853516 47.678680460743834,9.506263732910156 47.679258344995326,9.51364517211914 47.68191653011071,9.518795013427734 47.677177931734406,9.526691436767578 47.679489496903706,9.53390121459961 47.67139857075435,9.50918197631836 47.66180341832901,9.50815200805664 47.6529003141482,9.51192855834961 47.64654002455372,9.504375457763672 47.64237650648966,9.49270248413086 47.649662445325035,9.48617935180664 47.65151268066222,9.481201171875 47.64885294675266))"); + "POLYGON((9.481201171875 47.64885294675266,9.471416473388672" + + " 47.65128140482982,9.462661743164062 47.64781214443791,9.449443817138672" + + " 47.656947367880335,9.445838928222656 47.66110972448931,9.455795288085938" + + " 47.667352637215,9.469013214111328 47.67255449415724,9.477081298828125" + + " 47.679142768657066,9.490299224853516 47.678680460743834,9.506263732910156" + + " 47.679258344995326,9.51364517211914 47.68191653011071,9.518795013427734" + + " 47.677177931734406,9.526691436767578 47.679489496903706,9.53390121459961" + + " 47.67139857075435,9.50918197631836 47.66180341832901,9.50815200805664" + + " 47.6529003141482,9.51192855834961 47.64654002455372,9.504375457763672" + + " 47.64237650648966,9.49270248413086 47.649662445325035,9.48617935180664" + + " 47.65151268066222,9.481201171875 47.64885294675266))"); Document doc = new Document(); @@ -113,7 +123,32 @@ public void geoSpeedTest() throws IOException, ParseException { JtsSpatialContext.GEO .getWktShapeParser() .parse( - "MULTIPOLYGON (((15.520376 38.231155, 15.160243 37.444046, 15.309898 37.134219, 15.099988 36.619987, 14.335229 36.996631, 13.826733 37.104531, 12.431004 37.61295, 12.570944 38.126381, 13.741156 38.034966, 14.761249 38.143874, 15.520376 38.231155)), ((9.210012 41.209991, 9.809975 40.500009, 9.669519 39.177376, 9.214818 39.240473, 8.806936 38.906618, 8.428302 39.171847, 8.388253 40.378311, 8.159998 40.950007, 8.709991 40.899984, 9.210012 41.209991)), ((12.376485 46.767559, 13.806475 46.509306, 13.69811 46.016778, 13.93763 45.591016, 13.141606 45.736692, 12.328581 45.381778, 12.383875 44.885374, 12.261453 44.600482, 12.589237 44.091366, 13.526906 43.587727, 14.029821 42.761008, 15.14257 41.95514, 15.926191 41.961315, 16.169897 41.740295, 15.889346 41.541082, 16.785002 41.179606, 17.519169 40.877143, 18.376687 40.355625, 18.480247 40.168866, 18.293385 39.810774, 17.73838 40.277671, 16.869596 40.442235, 16.448743 39.795401, 17.17149 39.4247, 17.052841 38.902871, 16.635088 38.843572, 16.100961 37.985899, 15.684087 37.908849, 15.687963 38.214593, 15.891981 38.750942, 16.109332 38.964547, 15.718814 39.544072, 15.413613 40.048357, 14.998496 40.172949, 14.703268 40.60455, 14.060672 40.786348, 13.627985 41.188287, 12.888082 41.25309, 12.106683 41.704535, 11.191906 42.355425, 10.511948 42.931463, 10.200029 43.920007, 9.702488 44.036279, 8.888946 44.366336, 8.428561 44.231228, 7.850767 43.767148, 7.435185 43.693845, 7.549596 44.127901, 7.007562 44.254767, 6.749955 45.028518, 7.096652 45.333099, 6.802355 45.70858, 6.843593 45.991147, 7.273851 45.776948, 7.755992 45.82449, 8.31663 46.163642, 8.489952 46.005151, 8.966306 46.036932, 9.182882 46.440215, 9.922837 46.314899, 10.363378 46.483571, 10.442701 46.893546, 11.048556 46.751359, 11.164828 46.941579, 12.153088 47.115393, 12.376485 46.767559)))"); + "MULTIPOLYGON (((15.520376 38.231155, 15.160243 37.444046, 15.309898 37.134219," + + " 15.099988 36.619987, 14.335229 36.996631, 13.826733 37.104531, 12.431004" + + " 37.61295, 12.570944 38.126381, 13.741156 38.034966, 14.761249 38.143874," + + " 15.520376 38.231155)), ((9.210012 41.209991, 9.809975 40.500009, 9.669519" + + " 39.177376, 9.214818 39.240473, 8.806936 38.906618, 8.428302 39.171847," + + " 8.388253 40.378311, 8.159998 40.950007, 8.709991 40.899984, 9.210012" + + " 41.209991)), ((12.376485 46.767559, 13.806475 46.509306, 13.69811" + + " 46.016778, 13.93763 45.591016, 13.141606 45.736692, 12.328581 45.381778," + + " 12.383875 44.885374, 12.261453 44.600482, 12.589237 44.091366, 13.526906" + + " 43.587727, 14.029821 42.761008, 15.14257 41.95514, 15.926191 41.961315," + + " 16.169897 41.740295, 15.889346 41.541082, 16.785002 41.179606, 17.519169" + + " 40.877143, 18.376687 40.355625, 18.480247 40.168866, 18.293385 39.810774," + + " 17.73838 40.277671, 16.869596 40.442235, 16.448743 39.795401, 17.17149" + + " 39.4247, 17.052841 38.902871, 16.635088 38.843572, 16.100961 37.985899," + + " 15.684087 37.908849, 15.687963 38.214593, 15.891981 38.750942, 16.109332" + + " 38.964547, 15.718814 39.544072, 15.413613 40.048357, 14.998496 40.172949," + + " 14.703268 40.60455, 14.060672 40.786348, 13.627985 41.188287, 12.888082" + + " 41.25309, 12.106683 41.704535, 11.191906 42.355425, 10.511948 42.931463," + + " 10.200029 43.920007, 9.702488 44.036279, 8.888946 44.366336, 8.428561" + + " 44.231228, 7.850767 43.767148, 7.435185 43.693845, 7.549596 44.127901," + + " 7.007562 44.254767, 6.749955 45.028518, 7.096652 45.333099, 6.802355" + + " 45.70858, 6.843593 45.991147, 7.273851 45.776948, 7.755992 45.82449," + + " 8.31663 46.163642, 8.489952 46.005151, 8.966306 46.036932, 9.182882" + + " 46.440215, 9.922837 46.314899, 10.363378 46.483571, 10.442701 46.893546," + + " 11.048556 46.751359, 11.164828 46.941579, 12.153088 47.115393, 12.376485" + + " 46.767559)))"); Document doc = new Document(); diff --git a/object/pom.xml b/object/pom.xml index 8d144f60338..692ddf6b1e9 100755 --- a/object/pom.xml +++ b/object/pom.xml @@ -192,5 +192,7 @@ * UTF-8 + + 2023-01-01T00:00:00Z diff --git a/object/src/main/java/com/orientechnologies/orient/core/db/object/ODatabaseObject.java b/object/src/main/java/com/orientechnologies/orient/core/db/object/ODatabaseObject.java index 401d2770587..8857231f712 100644 --- a/object/src/main/java/com/orientechnologies/orient/core/db/object/ODatabaseObject.java +++ b/object/src/main/java/com/orientechnologies/orient/core/db/object/ODatabaseObject.java @@ -207,7 +207,9 @@ default RET detachAll(final Object iPojo) { @Override default T executeWithRetry(int nRetries, Function function) - throws IllegalStateException, IllegalArgumentException, ONeedRetryException, + throws IllegalStateException, + IllegalArgumentException, + ONeedRetryException, UnsupportedOperationException { throw new UnsupportedOperationException(); // TODO test it before enabling it! diff --git a/object/src/main/java/com/orientechnologies/orient/core/db/object/OLazyObjectListInterface.java b/object/src/main/java/com/orientechnologies/orient/core/db/object/OLazyObjectListInterface.java index 1f699a47fb7..1423de7612b 100644 --- a/object/src/main/java/com/orientechnologies/orient/core/db/object/OLazyObjectListInterface.java +++ b/object/src/main/java/com/orientechnologies/orient/core/db/object/OLazyObjectListInterface.java @@ -18,7 +18,9 @@ import java.util.List; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public interface OLazyObjectListInterface extends List { public void setConvertToRecord(boolean convertToRecord); diff --git a/object/src/main/java/com/orientechnologies/orient/core/db/object/OLazyObjectMapInterface.java b/object/src/main/java/com/orientechnologies/orient/core/db/object/OLazyObjectMapInterface.java index 34debd64c6b..530a180b361 100644 --- a/object/src/main/java/com/orientechnologies/orient/core/db/object/OLazyObjectMapInterface.java +++ b/object/src/main/java/com/orientechnologies/orient/core/db/object/OLazyObjectMapInterface.java @@ -18,7 +18,9 @@ import java.util.Map; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public interface OLazyObjectMapInterface extends Map { public void setConvertToRecord(boolean convertToRecord); diff --git a/object/src/main/java/com/orientechnologies/orient/core/db/object/OLazyObjectSetInterface.java b/object/src/main/java/com/orientechnologies/orient/core/db/object/OLazyObjectSetInterface.java index 0506d94488d..f3b7ba52ef0 100644 --- a/object/src/main/java/com/orientechnologies/orient/core/db/object/OLazyObjectSetInterface.java +++ b/object/src/main/java/com/orientechnologies/orient/core/db/object/OLazyObjectSetInterface.java @@ -18,7 +18,9 @@ import java.util.Set; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public interface OLazyObjectSetInterface extends Set { public void setConvertToRecord(boolean convertToRecord); diff --git a/object/src/main/java/com/orientechnologies/orient/core/db/object/OObjectLazyMultivalueElement.java b/object/src/main/java/com/orientechnologies/orient/core/db/object/OObjectLazyMultivalueElement.java index 6e3c817a7d8..ada2ac12c2d 100644 --- a/object/src/main/java/com/orientechnologies/orient/core/db/object/OObjectLazyMultivalueElement.java +++ b/object/src/main/java/com/orientechnologies/orient/core/db/object/OObjectLazyMultivalueElement.java @@ -18,7 +18,9 @@ import java.util.Map; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public interface OObjectLazyMultivalueElement { public void detach(boolean nonProxiedInstance); diff --git a/object/src/main/java/com/orientechnologies/orient/core/entity/OEntityManager.java b/object/src/main/java/com/orientechnologies/orient/core/entity/OEntityManager.java index d947bc3b266..79c90162ce6 100755 --- a/object/src/main/java/com/orientechnologies/orient/core/entity/OEntityManager.java +++ b/object/src/main/java/com/orientechnologies/orient/core/entity/OEntityManager.java @@ -85,7 +85,8 @@ public synchronized Object createPojo(final String iClassName) throws OConfigura new OConfigurationException( "The class '" + iClassName - + "' was not found between the entity classes. Ensure registerEntityClasses(package) has been called first"), + + "' was not found between the entity classes. Ensure" + + " registerEntityClasses(package) has been called first"), e); } } diff --git a/object/src/main/java/com/orientechnologies/orient/core/entity/OEntityManagerClassHandler.java b/object/src/main/java/com/orientechnologies/orient/core/entity/OEntityManagerClassHandler.java index e2746095948..b4fae196ecb 100644 --- a/object/src/main/java/com/orientechnologies/orient/core/entity/OEntityManagerClassHandler.java +++ b/object/src/main/java/com/orientechnologies/orient/core/entity/OEntityManagerClassHandler.java @@ -24,7 +24,9 @@ import java.util.Map.Entry; import java.util.Set; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OEntityManagerClassHandler { private Map> entityClasses = new HashMap>(); diff --git a/object/src/main/java/com/orientechnologies/orient/core/iterator/object/OObjectIteratorClassInterface.java b/object/src/main/java/com/orientechnologies/orient/core/iterator/object/OObjectIteratorClassInterface.java index c94d323ed6f..c27dafae567 100644 --- a/object/src/main/java/com/orientechnologies/orient/core/iterator/object/OObjectIteratorClassInterface.java +++ b/object/src/main/java/com/orientechnologies/orient/core/iterator/object/OObjectIteratorClassInterface.java @@ -18,7 +18,9 @@ import java.util.Iterator; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public interface OObjectIteratorClassInterface extends Iterator, Iterable { OObjectIteratorClassInterface setFetchPlan(String fetchPlan); } diff --git a/object/src/main/java/com/orientechnologies/orient/core/iterator/object/OObjectIteratorClusterInterface.java b/object/src/main/java/com/orientechnologies/orient/core/iterator/object/OObjectIteratorClusterInterface.java index 993a3321dac..0643f79148b 100644 --- a/object/src/main/java/com/orientechnologies/orient/core/iterator/object/OObjectIteratorClusterInterface.java +++ b/object/src/main/java/com/orientechnologies/orient/core/iterator/object/OObjectIteratorClusterInterface.java @@ -18,7 +18,9 @@ import java.util.Iterator; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public interface OObjectIteratorClusterInterface extends Iterator, Iterable { OObjectIteratorClusterInterface setFetchPlan(String fetchPlan); } diff --git a/object/src/main/java/com/orientechnologies/orient/object/db/OLazyCollectionUtil.java b/object/src/main/java/com/orientechnologies/orient/object/db/OLazyCollectionUtil.java index 32ce2575572..18ce0b16315 100755 --- a/object/src/main/java/com/orientechnologies/orient/object/db/OLazyCollectionUtil.java +++ b/object/src/main/java/com/orientechnologies/orient/object/db/OLazyCollectionUtil.java @@ -4,7 +4,9 @@ import com.orientechnologies.orient.core.db.ODatabaseInternal; import com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal; -/** @author Wouter de Vaal */ +/** + * @author Wouter de Vaal + */ public class OLazyCollectionUtil { /** Gets the current thread database as a ODatabasePojoAbstract, wrapping it where necessary. */ diff --git a/object/src/main/java/com/orientechnologies/orient/object/db/OObjectDatabasePool.java b/object/src/main/java/com/orientechnologies/orient/object/db/OObjectDatabasePool.java index cc92b2427d2..58f3b888d70 100755 --- a/object/src/main/java/com/orientechnologies/orient/object/db/OObjectDatabasePool.java +++ b/object/src/main/java/com/orientechnologies/orient/object/db/OObjectDatabasePool.java @@ -21,7 +21,9 @@ import com.orientechnologies.orient.core.db.ODatabasePoolBase; -/** @deprecated Please use com.orientechnologies.orient.core.db.OPartitionedDatabasePool instead. */ +/** + * @deprecated Please use com.orientechnologies.orient.core.db.OPartitionedDatabasePool instead. + */ @Deprecated public class OObjectDatabasePool extends ODatabasePoolBase { private static OObjectDatabasePool globalInstance = new OObjectDatabasePool(); diff --git a/object/src/main/java/com/orientechnologies/orient/object/db/OObjectDatabaseTx.java b/object/src/main/java/com/orientechnologies/orient/object/db/OObjectDatabaseTx.java index 2b738b051f8..3fbb886b280 100755 --- a/object/src/main/java/com/orientechnologies/orient/object/db/OObjectDatabaseTx.java +++ b/object/src/main/java/com/orientechnologies/orient/object/db/OObjectDatabaseTx.java @@ -243,7 +243,8 @@ public RET newInstance( throw new OSerializationException( "Type " + iClassName - + " cannot be serialized because is not part of registered entities. To fix this error register this class"); + + " cannot be serialized because is not part of registered entities. To fix this" + + " error register this class"); } } catch (Exception e) { final String message = "Error on creating object of class " + iClassName; @@ -280,7 +281,8 @@ public RET newInstance( throw new OSerializationException( "Type " + iClassName - + " cannot be serialized because is not part of registered entities. To fix this error register this class"); + + " cannot be serialized because is not part of registered entities. To fix this" + + " error register this class"); } } catch (Exception e) { final String message = "Error on creating object of class " + iClassName; @@ -1366,7 +1368,9 @@ public OResultSet execute(String language, String script, Map args) @Override public T executeWithRetry(int nRetries, Function function) - throws IllegalStateException, IllegalArgumentException, ONeedRetryException, + throws IllegalStateException, + IllegalArgumentException, + ONeedRetryException, UnsupportedOperationException { return underlying.executeWithRetry(nRetries, function); } diff --git a/object/src/main/java/com/orientechnologies/orient/object/db/OObjectDatabaseTxPooled.java b/object/src/main/java/com/orientechnologies/orient/object/db/OObjectDatabaseTxPooled.java index 52158023303..86081907ca9 100755 --- a/object/src/main/java/com/orientechnologies/orient/object/db/OObjectDatabaseTxPooled.java +++ b/object/src/main/java/com/orientechnologies/orient/object/db/OObjectDatabaseTxPooled.java @@ -69,25 +69,29 @@ public void reuse(final Object iOwner, final Object[] iAdditionalArgs) { @Override public OObjectDatabaseTxPooled open(String iUserName, String iUserPassword) { throw new UnsupportedOperationException( - "Database instance was retrieved from a pool. You cannot open the database in this way. Use directly a OObjectDatabaseTx instance if you want to manually open the connection"); + "Database instance was retrieved from a pool. You cannot open the database in this way. Use" + + " directly a OObjectDatabaseTx instance if you want to manually open the connection"); } @Override public OObjectDatabaseTxPooled open(OToken iToken) { throw new UnsupportedOperationException( - "Database instance was retrieved from a pool. You cannot open the database in this way. Use directly a OObjectDatabaseTx instance if you want to manually open the connection"); + "Database instance was retrieved from a pool. You cannot open the database in this way. Use" + + " directly a OObjectDatabaseTx instance if you want to manually open the connection"); } @Override public OObjectDatabaseTxPooled create() { throw new UnsupportedOperationException( - "Database instance was retrieved from a pool. You cannot open the database in this way. Use directly a OObjectDatabaseTx instance if you want to manually open the connection"); + "Database instance was retrieved from a pool. You cannot open the database in this way. Use" + + " directly a OObjectDatabaseTx instance if you want to manually open the connection"); } @Override public THISDB create(String incrementalBackupPath) { throw new UnsupportedOperationException( - "Database instance was retrieved from a pool. You cannot open the database in this way. Use directly a OObjectDatabaseTx instance if you want to manually open the connection"); + "Database instance was retrieved from a pool. You cannot open the database in this way. Use" + + " directly a OObjectDatabaseTx instance if you want to manually open the connection"); } @Override @@ -135,7 +139,8 @@ public void forceClose() { protected void checkOpenness() { if (ownerPool == null) throw new ODatabaseException( - "Database instance has been released to the pool. Get another database instance from the pool with the right username and password"); + "Database instance has been released to the pool. Get another database instance from the" + + " pool with the right username and password"); super.checkOpenness(); } diff --git a/object/src/main/java/com/orientechnologies/orient/object/enhancement/OObjectEntityEnhancer.java b/object/src/main/java/com/orientechnologies/orient/object/enhancement/OObjectEntityEnhancer.java index 49d89e9eafb..5d65db193ef 100755 --- a/object/src/main/java/com/orientechnologies/orient/object/enhancement/OObjectEntityEnhancer.java +++ b/object/src/main/java/com/orientechnologies/orient/object/enhancement/OObjectEntityEnhancer.java @@ -41,7 +41,9 @@ import javassist.util.proxy.ProxyFactory; import javassist.util.proxy.ProxyObject; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OObjectEntityEnhancer { private static final OObjectEntityEnhancer instance = new OObjectEntityEnhancer(); @@ -91,7 +93,8 @@ public T getProxiedInstance( throw new OSerializationException( "Type '" + doc.getClassName() - + "' cannot be serialized because is not part of registered entities. To fix this error register this class"); + + "' cannot be serialized because is not part of registered entities. To fix this" + + " error register this class"); } final Class c; boolean isInnerClass = OObjectEntitySerializer.getEnclosingClass(iClass) != null; @@ -280,8 +283,12 @@ protected void initDocument( } protected T createInstanceNoParameters(Class iProxiedClass, Class iOriginalClass) - throws SecurityException, NoSuchMethodException, IllegalArgumentException, - InstantiationException, IllegalAccessException, InvocationTargetException { + throws SecurityException, + NoSuchMethodException, + IllegalArgumentException, + InstantiationException, + IllegalAccessException, + InvocationTargetException { T instanceToReturn = null; final Class enclosingClass = OObjectEntitySerializer.getEnclosingClass(iOriginalClass); @@ -308,8 +315,12 @@ protected T createInstanceNoParameters(Class iProxiedClass, Class iOri } protected T createInstanceNoParameters(Class iProxiedClass, Object iEnclosingInstance) - throws SecurityException, NoSuchMethodException, IllegalArgumentException, - InstantiationException, IllegalAccessException, InvocationTargetException { + throws SecurityException, + NoSuchMethodException, + IllegalArgumentException, + InstantiationException, + IllegalAccessException, + InvocationTargetException { T instanceToReturn = null; final Class enclosingClass = iEnclosingInstance.getClass(); diff --git a/object/src/main/java/com/orientechnologies/orient/object/enhancement/OObjectEntitySerializer.java b/object/src/main/java/com/orientechnologies/orient/object/enhancement/OObjectEntitySerializer.java index e7e5bbb2567..8a52f2e2661 100755 --- a/object/src/main/java/com/orientechnologies/orient/object/enhancement/OObjectEntitySerializer.java +++ b/object/src/main/java/com/orientechnologies/orient/object/enhancement/OObjectEntitySerializer.java @@ -85,7 +85,9 @@ import javax.persistence.OneToMany; import javax.persistence.OneToOne; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OObjectEntitySerializer { public static final String SIMPLE_NAME = OObjectEntitySerializedSchema.class.getSimpleName(); @@ -883,7 +885,8 @@ public static Object typeToStream( + iFieldValue.getClass() + ":" + iFieldValue - + "] cannot be serialized because is not part of registered entities. To fix this error register this class"); + + "] cannot be serialized because is not part of registered entities. To fix" + + " this error register this class"); iFieldValue = result; } @@ -1233,7 +1236,8 @@ else if (id.getClass().equals(Object.class)) OLogManager.instance() .warn( OObjectSerializerHelper.class, - "@Id field has been declared as %s while the supported are: ORID, Number, String, Object", + "@Id field has been declared as %s while the supported are: ORID, Number, String," + + " Object", id.getClass()); } if (iRecord.getIdentity().isValid() && iRecord.getIdentity().isPersistent()) iRecord.reload(); @@ -1267,7 +1271,8 @@ else if (id.getClass().equals(Object.class)) throw new OTransactionException( "Cannot involve an object of class '" + pojoClass - + "' in an Optimistic Transaction commit because it does not define @Version or @OVersion and therefore cannot handle MVCC"); + + "' in an Optimistic Transaction commit because it does not define @Version or" + + " @OVersion and therefore cannot handle MVCC"); String fieldName; Object fieldValue; diff --git a/object/src/main/java/com/orientechnologies/orient/object/enhancement/OObjectMethodFilter.java b/object/src/main/java/com/orientechnologies/orient/object/enhancement/OObjectMethodFilter.java index 87e4fb23695..3de668ff0a5 100644 --- a/object/src/main/java/com/orientechnologies/orient/object/enhancement/OObjectMethodFilter.java +++ b/object/src/main/java/com/orientechnologies/orient/object/enhancement/OObjectMethodFilter.java @@ -119,7 +119,8 @@ public boolean isSetterMethod(final Method m) throws SecurityException, NoSuchFi + f.getName() + " in class " + m.getDeclaringClass().toString() - + " cannot be bound to proxied instance: parameter class don't match with field type " + + " cannot be bound to proxied instance: parameter class don't match with field" + + " type " + f.getType().toString()); isSetterCache.put(m, false); return false; diff --git a/object/src/main/java/com/orientechnologies/orient/object/enhancement/OObjectProxyMethodHandler.java b/object/src/main/java/com/orientechnologies/orient/object/enhancement/OObjectProxyMethodHandler.java index ab5a417c1ec..0d240e3015e 100755 --- a/object/src/main/java/com/orientechnologies/orient/object/enhancement/OObjectProxyMethodHandler.java +++ b/object/src/main/java/com/orientechnologies/orient/object/enhancement/OObjectProxyMethodHandler.java @@ -68,7 +68,9 @@ import javassist.util.proxy.Proxy; import javassist.util.proxy.ProxyObject; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OObjectProxyMethodHandler implements MethodHandler { protected final Map loadedFields; @@ -229,7 +231,9 @@ public void detachAll( * @throws NoSuchMethodException */ public void attach(final Object self) - throws IllegalArgumentException, IllegalAccessException, NoSuchMethodException, + throws IllegalArgumentException, + IllegalAccessException, + NoSuchMethodException, InvocationTargetException { for (Class currentClass = self.getClass(); currentClass != Object.class; ) { if (Proxy.class.isAssignableFrom(currentClass)) { @@ -313,8 +317,12 @@ public void updateLoadedFieldMap(final Object proxiedObject, final boolean iRelo protected Object manageGetMethod( final Object self, final Method m, final Method proceed, final Object[] args) - throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, - SecurityException, IllegalArgumentException, NoSuchFieldException { + throws IllegalAccessException, + InvocationTargetException, + NoSuchMethodException, + SecurityException, + IllegalArgumentException, + NoSuchFieldException { this.reading = true; final String fieldName = OObjectEntityEnhancer.getInstance().getMethodFilter(self.getClass()).getFieldName(m); @@ -993,7 +1001,8 @@ protected Object setValue(final Object self, final String fieldName, Object valu OLogManager.instance() .warn( this, - "Setting property '%s' in proxied class '%s' with an anonymous class '%s'. The document won't have this property.", + "Setting property '%s' in proxied class '%s' with an anonymous class '%s'. The" + + " document won't have this property.", fieldName, self.getClass().getName(), valueToSet.getClass().getName()); diff --git a/object/src/main/java/com/orientechnologies/orient/object/enhancement/field/ODocumentFieldHandlingStrategyFactory.java b/object/src/main/java/com/orientechnologies/orient/object/enhancement/field/ODocumentFieldHandlingStrategyFactory.java index 0f1f55c2309..f02ff5d4c3a 100644 --- a/object/src/main/java/com/orientechnologies/orient/object/enhancement/field/ODocumentFieldHandlingStrategyFactory.java +++ b/object/src/main/java/com/orientechnologies/orient/object/enhancement/field/ODocumentFieldHandlingStrategyFactory.java @@ -40,7 +40,9 @@ private ODocumentFieldHandlingStrategyFactory() { // Hidden } - /** @return an instance */ + /** + * @return an instance + */ public static ODocumentFieldHandlingStrategyFactory getInstance() { return INSTANCE; } diff --git a/object/src/main/java/com/orientechnologies/orient/object/enhancement/field/ODocumentFieldHandlingStrategyRegistry.java b/object/src/main/java/com/orientechnologies/orient/object/enhancement/field/ODocumentFieldHandlingStrategyRegistry.java index 07af222dcfe..7ed0719c263 100644 --- a/object/src/main/java/com/orientechnologies/orient/object/enhancement/field/ODocumentFieldHandlingStrategyRegistry.java +++ b/object/src/main/java/com/orientechnologies/orient/object/enhancement/field/ODocumentFieldHandlingStrategyRegistry.java @@ -35,7 +35,9 @@ private ODocumentFieldHandlingStrategyRegistry() { // Hidden } - /** @return an instance */ + /** + * @return an instance + */ public static ODocumentFieldHandlingStrategyRegistry getInstance() { return INSTANCE; } diff --git a/object/src/main/java/com/orientechnologies/orient/object/enhancement/field/ODocumentFieldOTypeHandlingStrategy.java b/object/src/main/java/com/orientechnologies/orient/object/enhancement/field/ODocumentFieldOTypeHandlingStrategy.java index 0fecc947a6e..7b7cf3bc9cb 100644 --- a/object/src/main/java/com/orientechnologies/orient/object/enhancement/field/ODocumentFieldOTypeHandlingStrategy.java +++ b/object/src/main/java/com/orientechnologies/orient/object/enhancement/field/ODocumentFieldOTypeHandlingStrategy.java @@ -42,6 +42,8 @@ public interface ODocumentFieldOTypeHandlingStrategy { */ Object load(ODocument iRecord, String fieldName); - /** @return {@link OType} handled by the strategy. */ + /** + * @return {@link OType} handled by the strategy. + */ OType getOType(); } diff --git a/object/src/main/java/com/orientechnologies/orient/object/entity/OObjectEntityClassHandler.java b/object/src/main/java/com/orientechnologies/orient/object/entity/OObjectEntityClassHandler.java index 7396ffa5d1c..669a22ec405 100644 --- a/object/src/main/java/com/orientechnologies/orient/object/entity/OObjectEntityClassHandler.java +++ b/object/src/main/java/com/orientechnologies/orient/object/entity/OObjectEntityClassHandler.java @@ -21,7 +21,9 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OObjectEntityClassHandler extends OEntityManagerClassHandler { private static final ConcurrentMap instances = diff --git a/object/src/main/java/com/orientechnologies/orient/object/enumerations/OObjectEnumLazyList.java b/object/src/main/java/com/orientechnologies/orient/object/enumerations/OObjectEnumLazyList.java index 7a8853ad42d..1d22d44baec 100644 --- a/object/src/main/java/com/orientechnologies/orient/object/enumerations/OObjectEnumLazyList.java +++ b/object/src/main/java/com/orientechnologies/orient/object/enumerations/OObjectEnumLazyList.java @@ -24,7 +24,9 @@ import java.util.ListIterator; import java.util.Map; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ @SuppressWarnings({"unchecked"}) public class OObjectEnumLazyList> implements List, OObjectLazyEnumSerializer>, Serializable { diff --git a/object/src/main/java/com/orientechnologies/orient/object/enumerations/OObjectEnumLazySet.java b/object/src/main/java/com/orientechnologies/orient/object/enumerations/OObjectEnumLazySet.java index ace86a9be77..d0cf8c47cc7 100644 --- a/object/src/main/java/com/orientechnologies/orient/object/enumerations/OObjectEnumLazySet.java +++ b/object/src/main/java/com/orientechnologies/orient/object/enumerations/OObjectEnumLazySet.java @@ -23,7 +23,9 @@ import java.util.Map; import java.util.Set; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ @SuppressWarnings("unchecked") public class OObjectEnumLazySet extends HashSet implements OObjectLazyEnumSerializer>, Serializable { diff --git a/object/src/main/java/com/orientechnologies/orient/object/enumerations/OObjectLazyEnumSerializer.java b/object/src/main/java/com/orientechnologies/orient/object/enumerations/OObjectLazyEnumSerializer.java index 79e818f3ae3..5460aff1536 100644 --- a/object/src/main/java/com/orientechnologies/orient/object/enumerations/OObjectLazyEnumSerializer.java +++ b/object/src/main/java/com/orientechnologies/orient/object/enumerations/OObjectLazyEnumSerializer.java @@ -18,5 +18,7 @@ import com.orientechnologies.orient.core.db.object.OObjectLazyMultivalueElement; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public interface OObjectLazyEnumSerializer extends OObjectLazyMultivalueElement {} diff --git a/object/src/main/java/com/orientechnologies/orient/object/jpa/OJPAPersistenceUnitInfo.java b/object/src/main/java/com/orientechnologies/orient/object/jpa/OJPAPersistenceUnitInfo.java index 430298a3f7c..e74cb046d0a 100644 --- a/object/src/main/java/com/orientechnologies/orient/object/jpa/OJPAPersistenceUnitInfo.java +++ b/object/src/main/java/com/orientechnologies/orient/object/jpa/OJPAPersistenceUnitInfo.java @@ -51,6 +51,7 @@ public class OJPAPersistenceUnitInfo implements PersistenceUnitInfo { * unit's root. */ private final URL unitRootUrl; + /** * the list of mapping file names that the persistence provider must load to determine the * mappings for the entity classes @@ -122,37 +123,51 @@ public OJPAPersistenceUnitInfo( this.transactionType = initTransactionType(transactionType); } - /** @param provider */ + /** + * @param provider + */ public void setProviderClassName(String providerClassName) { this.providerClassName = providerClassName; } - /** @param jtaDataSource */ + /** + * @param jtaDataSource + */ public void setJtaDataSource(String jtaDataSource) { // TODO: implement } - /** @param nonJtaDataSource */ + /** + * @param nonJtaDataSource + */ public void setNonJtaDataSource(String nonJtaDataSource) { // TODO: implement } - /** @param mappingFileName */ + /** + * @param mappingFileName + */ public void addMappingFileName(String mappingFileName) { mappingFileNames.add(mappingFileName); } - /** @param jarFileName */ + /** + * @param jarFileName + */ public void addJarFileName(String jarFileName) { jarFileUrls.add(initJarFile(jarFileName)); } - /** @param className */ + /** + * @param className + */ public void addClassName(String className) { managedClassNames.add(className); } - /** @param exclude */ + /** + * @param exclude + */ public void setExcludeUnlisted(boolean exclude) { excludeUnlistedClasses = exclude; } @@ -165,12 +180,16 @@ public void addProperty(String name, String value) { properties.setProperty(name, value); } - /** @param sharedCacheMode */ + /** + * @param sharedCacheMode + */ public void setSharedCacheMode(String sharedCacheMode) { this.sharedCacheMode = initSharedCacheMode(sharedCacheMode); } - /** @param validationMode */ + /** + * @param validationMode + */ public void setValidationMode(String validationMode) { this.validationMode = initValidationMode(validationMode); } diff --git a/object/src/main/java/com/orientechnologies/orient/object/jpa/OJPAProperties.java b/object/src/main/java/com/orientechnologies/orient/object/jpa/OJPAProperties.java index 85fb4987255..b96184111b2 100644 --- a/object/src/main/java/com/orientechnologies/orient/object/jpa/OJPAProperties.java +++ b/object/src/main/java/com/orientechnologies/orient/object/jpa/OJPAProperties.java @@ -35,6 +35,7 @@ final class OJPAProperties extends Properties { public static final String URL = "javax.persistence.jdbc.url"; public static final String USER = "javax.persistence.jdbc.user"; public static final String PASSWORD = "javax.persistence.jdbc.password"; + /** OrientDB specific */ public static final String ENTITY_CLASSES_PACKAGE = "com.orientdb.entityClasses"; @@ -63,7 +64,9 @@ public OJPAProperties(final Map properties) { } } - /** @return Unmodifiable Map of properties for use by the persistence provider. */ + /** + * @return Unmodifiable Map of properties for use by the persistence provider. + */ @SuppressWarnings({"unchecked", "rawtypes"}) public Map getUnmodifiableProperties() { return Collections.unmodifiableMap((Map) this); diff --git a/object/src/main/java/com/orientechnologies/orient/object/jpa/parsing/JPAHandler.java b/object/src/main/java/com/orientechnologies/orient/object/jpa/parsing/JPAHandler.java index 3caf09d270b..f9f30875f7f 100644 --- a/object/src/main/java/com/orientechnologies/orient/object/jpa/parsing/JPAHandler.java +++ b/object/src/main/java/com/orientechnologies/orient/object/jpa/parsing/JPAHandler.java @@ -34,12 +34,16 @@ public class JPAHandler extends DefaultHandler { /** The Persistence Units that we have parsed */ private final Stack persistenceUnits = new Stack(); + /** root of the persistence unit */ private final URL persistenceXmlRoot; + /** The version of the persistence.xml file */ private String xmlSchemaVersion; + /** The name of the current element */ private PersistenceXml element; + /** A StringBuilder for caching the information from getCharacters */ private StringBuilder builder = new StringBuilder(); @@ -153,7 +157,9 @@ public void error(SAXParseException spe) throws SAXException { throw spe; } - /** @return The collection of persistence units that we have parsed */ + /** + * @return The collection of persistence units that we have parsed + */ public Collection getPersistenceUnits() { return persistenceUnits; } diff --git a/object/src/main/java/com/orientechnologies/orient/object/jpa/parsing/JPAVersion.java b/object/src/main/java/com/orientechnologies/orient/object/jpa/parsing/JPAVersion.java index ce3d0690943..a645001b5a0 100644 --- a/object/src/main/java/com/orientechnologies/orient/object/jpa/parsing/JPAVersion.java +++ b/object/src/main/java/com/orientechnologies/orient/object/jpa/parsing/JPAVersion.java @@ -33,7 +33,9 @@ public enum JPAVersion { this.minor = minor; } - /** @return jpa version formated as MAJOR_MINOR */ + /** + * @return jpa version formated as MAJOR_MINOR + */ public String getVersion() { return String.format("%d.%d", major, minor); } diff --git a/object/src/main/java/com/orientechnologies/orient/object/jpa/parsing/PersistenceXmlUtil.java b/object/src/main/java/com/orientechnologies/orient/object/jpa/parsing/PersistenceXmlUtil.java index 19c2105e1f3..9063f4ef4b1 100644 --- a/object/src/main/java/com/orientechnologies/orient/object/jpa/parsing/PersistenceXmlUtil.java +++ b/object/src/main/java/com/orientechnologies/orient/object/jpa/parsing/PersistenceXmlUtil.java @@ -58,8 +58,10 @@ public final class PersistenceXmlUtil { public static final String PERSISTENCE_XML_ROOT = "META-INF/"; public static final String PERSISTENCE_XML_BASE_NAME = "persistence.xml"; + /** The persistence XSD location */ public static final String PERSISTENCE_XSD_DIR = PERSISTENCE_XML_ROOT + "persistence/"; + /** The persistence XML location */ public static final String PERSISTENCE_XML = PERSISTENCE_XML_ROOT + PERSISTENCE_XML_BASE_NAME; diff --git a/object/src/main/java/com/orientechnologies/orient/object/jpa/parsing/SchemaLocatingHandler.java b/object/src/main/java/com/orientechnologies/orient/object/jpa/parsing/SchemaLocatingHandler.java index cf017d1564c..328b8cb7050 100644 --- a/object/src/main/java/com/orientechnologies/orient/object/jpa/parsing/SchemaLocatingHandler.java +++ b/object/src/main/java/com/orientechnologies/orient/object/jpa/parsing/SchemaLocatingHandler.java @@ -42,7 +42,9 @@ public void startElement(String uri, String localName, String name, Attributes a } } - /** @return The version of the JPA schema used */ + /** + * @return The version of the JPA schema used + */ public String getVersion() { return schemaVersion; } diff --git a/object/src/main/java/com/orientechnologies/orient/object/metadata/OMetadataObject.java b/object/src/main/java/com/orientechnologies/orient/object/metadata/OMetadataObject.java index ef64cd19c3b..1d1d2303fdf 100644 --- a/object/src/main/java/com/orientechnologies/orient/object/metadata/OMetadataObject.java +++ b/object/src/main/java/com/orientechnologies/orient/object/metadata/OMetadataObject.java @@ -30,7 +30,9 @@ import com.orientechnologies.orient.object.metadata.schema.OSchemaProxyObject; import java.io.IOException; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OMetadataObject implements OMetadataInternal { protected OMetadataInternal underlying; diff --git a/object/src/main/java/com/orientechnologies/orient/object/metadata/schema/OSchemaProxyObject.java b/object/src/main/java/com/orientechnologies/orient/object/metadata/schema/OSchemaProxyObject.java index 178f25aa140..39b84aed075 100755 --- a/object/src/main/java/com/orientechnologies/orient/object/metadata/schema/OSchemaProxyObject.java +++ b/object/src/main/java/com/orientechnologies/orient/object/metadata/schema/OSchemaProxyObject.java @@ -46,7 +46,9 @@ import java.util.Set; import javassist.util.proxy.Proxy; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OSchemaProxyObject implements OSchemaObject { protected OSchema underlying; diff --git a/object/src/main/java/com/orientechnologies/orient/object/serialization/OObjectCustomSerializerSet.java b/object/src/main/java/com/orientechnologies/orient/object/serialization/OObjectCustomSerializerSet.java index 484b57d44d1..6452f1800d9 100644 --- a/object/src/main/java/com/orientechnologies/orient/object/serialization/OObjectCustomSerializerSet.java +++ b/object/src/main/java/com/orientechnologies/orient/object/serialization/OObjectCustomSerializerSet.java @@ -24,7 +24,9 @@ import java.util.Map; import java.util.Set; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ @SuppressWarnings("unchecked") public class OObjectCustomSerializerSet extends HashSet implements OObjectLazyCustomSerializer>, Serializable { diff --git a/object/src/main/java/com/orientechnologies/orient/object/serialization/OObjectLazyCustomSerializer.java b/object/src/main/java/com/orientechnologies/orient/object/serialization/OObjectLazyCustomSerializer.java index d63dd769b3b..3e41a42af9e 100644 --- a/object/src/main/java/com/orientechnologies/orient/object/serialization/OObjectLazyCustomSerializer.java +++ b/object/src/main/java/com/orientechnologies/orient/object/serialization/OObjectLazyCustomSerializer.java @@ -18,5 +18,7 @@ import com.orientechnologies.orient.core.db.object.OObjectLazyMultivalueElement; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public interface OObjectLazyCustomSerializer extends OObjectLazyMultivalueElement {} diff --git a/object/src/main/java/com/orientechnologies/orient/object/serialization/OObjectSerializerHelper.java b/object/src/main/java/com/orientechnologies/orient/object/serialization/OObjectSerializerHelper.java index bcc1cec4f91..413af19297e 100755 --- a/object/src/main/java/com/orientechnologies/orient/object/serialization/OObjectSerializerHelper.java +++ b/object/src/main/java/com/orientechnologies/orient/object/serialization/OObjectSerializerHelper.java @@ -266,7 +266,8 @@ else if (fieldType.equals(String.class)) OLogManager.instance() .warn( OObjectSerializerHelper.class, - "@Id field has been declared as %s while the supported are: ORID, Number, String, Object", + "@Id field has been declared as %s while the supported are: ORID, Number, String," + + " Object", fieldType); return idFieldName; } @@ -335,7 +336,8 @@ public static String setObjectVersion(final int iVersion, final Object iPojo) { OLogManager.instance() .warn( OObjectSerializerHelper.class, - "@Version field has been declared as %s while the supported are: Number, String, Object", + "@Version field has been declared as %s while the supported are: Number, String," + + " Object", fieldType); return vFieldName; } @@ -366,7 +368,8 @@ private static int convertVersion(final Object ver) { OLogManager.instance() .warn( OObjectSerializerHelper.class, - "@Version field has been declared as %s while the supported are: Number, String, Object", + "@Version field has been declared as %s while the supported are: Number, String," + + " Object", ver.getClass()); } return -1; @@ -438,7 +441,8 @@ else if (id.getClass().equals(Object.class)) OLogManager.instance() .warn( OObjectSerializerHelper.class, - "@Id field has been declared as %s while the supported are: ORID, Number, String, Object", + "@Id field has been declared as %s while the supported are: ORID, Number, String," + + " Object", id.getClass()); } } @@ -458,7 +462,8 @@ else if (id.getClass().equals(Object.class)) throw new OTransactionException( "Cannot involve an object of class '" + pojoClass - + "' in an Optimistic Transaction commit because it does not define @Version or @OVersion and therefore cannot handle MVCC"); + + "' in an Optimistic Transaction commit because it does not define @Version or" + + " @OVersion and therefore cannot handle MVCC"); // SET OBJECT CLASS iRecord.setClassName(schemaClass != null ? schemaClass.getName() : null); @@ -616,7 +621,8 @@ private static Object typeToStream( + iFieldValue.getClass() + ":" + iFieldValue - + "] cannot be serialized because is not part of registered entities. To fix this error register this class"); + + "] cannot be serialized because is not part of registered entities. To fix" + + " this error register this class"); iFieldValue = result; } diff --git a/object/src/test/java/com/orientechnologies/orient/object/db/entity/NestedContainer.java b/object/src/test/java/com/orientechnologies/orient/object/db/entity/NestedContainer.java index 41967b6d3cc..f70524c896a 100644 --- a/object/src/test/java/com/orientechnologies/orient/object/db/entity/NestedContainer.java +++ b/object/src/test/java/com/orientechnologies/orient/object/db/entity/NestedContainer.java @@ -18,7 +18,9 @@ import java.util.ArrayList; import java.util.HashMap; -/** @author dominik.kopczynski */ +/** + * @author dominik.kopczynski + */ public class NestedContainer { private String name; HashMap> foo = new HashMap>(); diff --git a/object/src/test/java/com/orientechnologies/orient/object/db/entity/NestedContent.java b/object/src/test/java/com/orientechnologies/orient/object/db/entity/NestedContent.java index fb2aae134e4..a74813e4718 100644 --- a/object/src/test/java/com/orientechnologies/orient/object/db/entity/NestedContent.java +++ b/object/src/test/java/com/orientechnologies/orient/object/db/entity/NestedContent.java @@ -15,7 +15,9 @@ */ package com.orientechnologies.orient.object.db.entity; -/** @author dominik.kopczynski */ +/** + * @author dominik.kopczynski + */ public class NestedContent { private String name; diff --git a/object/src/test/java/com/orientechnologies/orient/object/enhancement/field/OObjectBinaryDataStorageTest.java b/object/src/test/java/com/orientechnologies/orient/object/enhancement/field/OObjectBinaryDataStorageTest.java index 2e02afcc6fa..5725ac7d3b7 100644 --- a/object/src/test/java/com/orientechnologies/orient/object/enhancement/field/OObjectBinaryDataStorageTest.java +++ b/object/src/test/java/com/orientechnologies/orient/object/enhancement/field/OObjectBinaryDataStorageTest.java @@ -23,7 +23,9 @@ import org.junit.Assert; import org.junit.Test; -/** @author diegomtassis Diego Martin Tassis */ +/** + * @author diegomtassis Diego Martin Tassis + */ public class OObjectBinaryDataStorageTest { private OObjectDatabaseTx databaseTx; diff --git a/object/src/test/java/com/orientechnologies/orient/object/jpa/parsing/PersistenceXMLParsingTest.java b/object/src/test/java/com/orientechnologies/orient/object/jpa/parsing/PersistenceXMLParsingTest.java index 503a1875ef5..45c1f4a513e 100644 --- a/object/src/test/java/com/orientechnologies/orient/object/jpa/parsing/PersistenceXMLParsingTest.java +++ b/object/src/test/java/com/orientechnologies/orient/object/jpa/parsing/PersistenceXMLParsingTest.java @@ -47,8 +47,11 @@ public class PersistenceXMLParsingTest { public static void assertPersistenceUnit(PersistenceUnitInfo unit, Rule[] rules) - throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, - NoSuchMethodException, SecurityException { + throws IllegalAccessException, + IllegalArgumentException, + InvocationTargetException, + NoSuchMethodException, + SecurityException { for (int i = 0; i < rules.length; i++) { Method method = OJPAPersistenceUnitInfo.class.getDeclaredMethod(rules[i].method); String msg = diff --git a/pom.xml b/pom.xml index 2bb53c598b2..04d7ad1c975 100644 --- a/pom.xml +++ b/pom.xml @@ -159,7 +159,10 @@ UTF-8 17 17 + 17 yyyy-MM-dd HH:mm:ssZ + + 2023-01-01T00:00:00Z ${scmBranch}@r${buildNumber} 2.6.0 @@ -299,9 +302,9 @@ - com.coveo - fmt-maven-plugin - 2.13 + com.diffplug.spotless + spotless-maven-plugin + 2.42.0 @@ -315,7 +318,6 @@ maven-release-plugin 3.0.1 - all true false @{project.version} @@ -416,77 +418,8 @@ - - false - false - - true - - ?????? - - - - io.github.zlika - reproducible-build-maven-plugin - 0.5 - - - - strip-jar - strip-jaxb - - - - - org.apache.felix - maven-bundle-plugin - 3.0.1 - - - org.codehaus.plexus - plexus-archiver - 4.8.0 - - - - - - true - - true - ${project.build.directory}/osgi - - - <_nouses>true - - <_removeheaders>JAVA_1_3_HOME,JAVA_1_4_HOME,JAVA_1_5_HOME,JAVA_1_6_HOME,JAVA_1_7_HOME, - Bnd-LastModified,Built-By,Private-Package,Tool,Created-By,Build-Jdk,Include-Resource, - Ignore-Package,Private-Package,Bundle-DocURL - - ${osgi.fragment.host} - ${osgi.export} - ${osgi.private} - ${project.groupId}.*;provide:=true,${osgi.import} - ${osgi.dynamicImport} - JavaSE-1.6 - - - - - bundle-manifest - process-classes - - manifest - - - - org.apache.maven.plugins maven-jar-plugin @@ -539,12 +472,24 @@ maven-javadoc-plugin - com.coveo - fmt-maven-plugin - 2.9.1 + com.diffplug.spotless + spotless-maven-plugin + 2.42.0 + + + + 1.19.2 + + true + false + + + + + + - compile check diff --git a/security/pom.xml b/security/pom.xml index 6bbf3bea42b..b74a392d540 100644 --- a/security/pom.xml +++ b/security/pom.xml @@ -39,6 +39,8 @@ 2016 + + 2023-01-01T00:00:00Z ${maven.compiler.source} ${maven.compiler.target} UTF-8 diff --git a/security/src/main/java/com/cloudbees/syslog/Facility.java b/security/src/main/java/com/cloudbees/syslog/Facility.java index 6d263428850..3e6cacf4588 100644 --- a/security/src/main/java/com/cloudbees/syslog/Facility.java +++ b/security/src/main/java/com/cloudbees/syslog/Facility.java @@ -93,6 +93,7 @@ public enum Facility implements Comparable { /** Syslog facility numerical code */ private final int numericalCode; + /** Syslog facility textual code. Not {@code null} */ private final String label; diff --git a/security/src/main/java/com/cloudbees/syslog/SyslogMessage.java b/security/src/main/java/com/cloudbees/syslog/SyslogMessage.java index 06c4d6f09f2..9cfa194b010 100644 --- a/security/src/main/java/com/cloudbees/syslog/SyslogMessage.java +++ b/security/src/main/java/com/cloudbees/syslog/SyslogMessage.java @@ -89,6 +89,7 @@ protected String newObject() { private String appName; private String procId; private String msgId; + /** * Use a {@link java.io.CharArrayWriter} instead of a {@link String} or a {@code char[]} because * middlewares like Apache Tomcat use {@code CharArrayWriter} and it's convenient for pooling diff --git a/security/src/main/java/com/cloudbees/syslog/integration/jul/AbstractHandler.java b/security/src/main/java/com/cloudbees/syslog/integration/jul/AbstractHandler.java index fd99a37a487..9c72ab1dbc0 100644 --- a/security/src/main/java/com/cloudbees/syslog/integration/jul/AbstractHandler.java +++ b/security/src/main/java/com/cloudbees/syslog/integration/jul/AbstractHandler.java @@ -18,7 +18,9 @@ import com.cloudbees.syslog.integration.jul.util.LogManagerHelper; import java.util.logging.*; -/** @author Cyrille Le Clerc */ +/** + * @author Cyrille Le Clerc + */ public abstract class AbstractHandler extends Handler { private Level logLevel = Level.ALL; diff --git a/security/src/main/java/com/cloudbees/syslog/integration/jul/SyslogHandler.java b/security/src/main/java/com/cloudbees/syslog/integration/jul/SyslogHandler.java index b4c33fab304..905b77def47 100644 --- a/security/src/main/java/com/cloudbees/syslog/integration/jul/SyslogHandler.java +++ b/security/src/main/java/com/cloudbees/syslog/integration/jul/SyslogHandler.java @@ -26,7 +26,9 @@ import java.io.IOException; import java.util.logging.*; -/** @author Cyrille Le Clerc */ +/** + * @author Cyrille Le Clerc + */ public class SyslogHandler extends AbstractHandler { private SyslogMessageSender syslogMessageSender; diff --git a/security/src/main/java/com/cloudbees/syslog/integration/jul/SyslogMessageFormatter.java b/security/src/main/java/com/cloudbees/syslog/integration/jul/SyslogMessageFormatter.java index 98d80a38351..31c26b4d06d 100644 --- a/security/src/main/java/com/cloudbees/syslog/integration/jul/SyslogMessageFormatter.java +++ b/security/src/main/java/com/cloudbees/syslog/integration/jul/SyslogMessageFormatter.java @@ -20,7 +20,9 @@ import java.util.logging.Formatter; import java.util.logging.LogRecord; -/** @author Cyrille Le Clerc */ +/** + * @author Cyrille Le Clerc + */ public class SyslogMessageFormatter extends Formatter { @Override diff --git a/security/src/main/java/com/cloudbees/syslog/integration/jul/util/LevelHelper.java b/security/src/main/java/com/cloudbees/syslog/integration/jul/util/LevelHelper.java index 6addc4d2b9f..fd906db7351 100644 --- a/security/src/main/java/com/cloudbees/syslog/integration/jul/util/LevelHelper.java +++ b/security/src/main/java/com/cloudbees/syslog/integration/jul/util/LevelHelper.java @@ -19,7 +19,9 @@ import java.util.*; import java.util.logging.Level; -/** @author Cyrille Le Clerc */ +/** + * @author Cyrille Le Clerc + */ public class LevelHelper { public static final List levels = diff --git a/security/src/main/java/com/cloudbees/syslog/integration/jul/util/LogManagerHelper.java b/security/src/main/java/com/cloudbees/syslog/integration/jul/util/LogManagerHelper.java index 373d55f11d9..b0e86b7cdd1 100644 --- a/security/src/main/java/com/cloudbees/syslog/integration/jul/util/LogManagerHelper.java +++ b/security/src/main/java/com/cloudbees/syslog/integration/jul/util/LogManagerHelper.java @@ -20,7 +20,9 @@ import java.util.logging.Level; import java.util.logging.LogManager; -/** @author Cyrille Le Clerc */ +/** + * @author Cyrille Le Clerc + */ public class LogManagerHelper { /** diff --git a/security/src/main/java/com/cloudbees/syslog/sender/AbstractSyslogMessageSender.java b/security/src/main/java/com/cloudbees/syslog/sender/AbstractSyslogMessageSender.java index 086f3bba160..70d08c4f4d0 100644 --- a/security/src/main/java/com/cloudbees/syslog/sender/AbstractSyslogMessageSender.java +++ b/security/src/main/java/com/cloudbees/syslog/sender/AbstractSyslogMessageSender.java @@ -24,7 +24,9 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; -/** @author Cyrille Le Clerc */ +/** + * @author Cyrille Le Clerc + */ public abstract class AbstractSyslogMessageSender implements SyslogMessageSender { protected static final Charset UTF_8 = Charset.forName("UTF-8"); protected final InternalLogger logger = InternalLogger.getLogger(getClass()); @@ -33,6 +35,7 @@ public abstract class AbstractSyslogMessageSender implements SyslogMessageSender protected Facility defaultFacility = Facility.USER; protected String defaultMessageHostname; protected Severity defaultSeverity = Severity.INFORMATIONAL; + // remote syslog server config /** * Format of messages accepted by the remote syslog server ({@link @@ -40,6 +43,7 @@ public abstract class AbstractSyslogMessageSender implements SyslogMessageSender * com.cloudbees.syslog.MessageFormat#RFC_5424 RFC_5424}) */ protected MessageFormat messageFormat = DEFAULT_SYSLOG_MESSAGE_FORMAT; + // statistics protected final AtomicInteger sendCounter = new AtomicInteger(); protected final AtomicLong sendDurationInNanosCounter = new AtomicLong(); diff --git a/security/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java b/security/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java index ad0588e35e1..f16710224c5 100644 --- a/security/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java +++ b/security/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java @@ -53,6 +53,7 @@ public class TcpSyslogMessageSender extends AbstractSyslogMessageSender { *

    Default value: {@link #DEFAULT_SYSLOG_HOST} */ protected CachingReference syslogServerHostnameReference; + /** * Listen port of the remote Syslog server. * @@ -64,8 +65,10 @@ public class TcpSyslogMessageSender extends AbstractSyslogMessageSender { private Writer writer; private int socketConnectTimeoutInMillis = SETTING_SOCKET_CONNECT_TIMEOUT_IN_MILLIS_DEFAULT_VALUE; private boolean ssl; + /** Number of retries to send a message before throwing an exception. */ private int maxRetryCount = SETTING_MAX_RETRY; + /** Number of exceptions trying to send message. */ protected final AtomicInteger trySendErrorCounter = new AtomicInteger(); diff --git a/security/src/main/java/com/cloudbees/syslog/sender/UdpSyslogMessageSender.java b/security/src/main/java/com/cloudbees/syslog/sender/UdpSyslogMessageSender.java index bc75dc65062..6c2a5e24693 100644 --- a/security/src/main/java/com/cloudbees/syslog/sender/UdpSyslogMessageSender.java +++ b/security/src/main/java/com/cloudbees/syslog/sender/UdpSyslogMessageSender.java @@ -45,6 +45,7 @@ public class UdpSyslogMessageSender extends AbstractSyslogMessageSender { *

    Default value: {@link #DEFAULT_SYSLOG_HOST} */ protected CachingReference syslogServerHostnameReference; + /** * Listen port of the remote Syslog server. * diff --git a/security/src/main/java/com/cloudbees/syslog/util/CachingReference.java b/security/src/main/java/com/cloudbees/syslog/util/CachingReference.java index f5e158e494d..7e3b5cdd7fb 100644 --- a/security/src/main/java/com/cloudbees/syslog/util/CachingReference.java +++ b/security/src/main/java/com/cloudbees/syslog/util/CachingReference.java @@ -58,10 +58,14 @@ public CachingReference(long timeToLive, TimeUnit timeToLiveUnit) { this(TimeUnit.NANOSECONDS.convert(timeToLive, timeToLiveUnit)); } - /** @return the newly created object. */ + /** + * @return the newly created object. + */ protected abstract E newObject(); - /** @return the up to date version of the {@code Object} hold by this reference. */ + /** + * @return the up to date version of the {@code Object} hold by this reference. + */ public E get() { rwl.readLock().lock(); try { diff --git a/security/src/main/java/com/cloudbees/syslog/util/InternalLogger.java b/security/src/main/java/com/cloudbees/syslog/util/InternalLogger.java index 3cf25dfbb99..2fc3a79d480 100644 --- a/security/src/main/java/com/cloudbees/syslog/util/InternalLogger.java +++ b/security/src/main/java/com/cloudbees/syslog/util/InternalLogger.java @@ -58,6 +58,7 @@ public static void setLevel(Level level) { private DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS"); private final String name; + /** use java.util.logger to find the logger level if not specified by system property. */ private final Logger julLogger; diff --git a/security/src/main/java/com/cloudbees/syslog/util/IoUtils.java b/security/src/main/java/com/cloudbees/syslog/util/IoUtils.java index 1dedc6fb9ce..50df0e301d1 100644 --- a/security/src/main/java/com/cloudbees/syslog/util/IoUtils.java +++ b/security/src/main/java/com/cloudbees/syslog/util/IoUtils.java @@ -19,7 +19,9 @@ import java.io.Writer; import java.net.Socket; -/** @author Cyrille Le Clerc */ +/** + * @author Cyrille Le Clerc + */ public class IoUtils { private IoUtils() {} diff --git a/security/src/main/java/com/orientechnologies/security/kerberos/OKerberosAuthenticator.java b/security/src/main/java/com/orientechnologies/security/kerberos/OKerberosAuthenticator.java index 447a3ddd309..b50d19261f8 100644 --- a/security/src/main/java/com/orientechnologies/security/kerberos/OKerberosAuthenticator.java +++ b/security/src/main/java/com/orientechnologies/security/kerberos/OKerberosAuthenticator.java @@ -126,7 +126,8 @@ public OSecurityUser authenticate( OLogManager.instance() .info( this, - "OKerberosAuthenticator.authenticate() TicketHash and password Hash are equal, return principal: " + "OKerberosAuthenticator.authenticate() TicketHash and password Hash are" + + " equal, return principal: " + ti.getPrincipal()); if (isDebug()) OLogManager.instance() @@ -165,7 +166,8 @@ public OSecurityUser authenticate( OLogManager.instance() .info( this, - "OKerberosAuthenticator.authenticate() OKerberosLibrary.authenticate() returned " + "OKerberosAuthenticator.authenticate() OKerberosLibrary.authenticate()" + + " returned " + principal); // OLogManager.instance().info(this, "OKerberosAuthenticator.authenticate() @@ -410,10 +412,12 @@ private void createClientSubject() { "OKerberosAuthenticator.createClientSubject() Client Principal cannot be null"); if (clientUseTicketCache && clientCCName == null) throw new OSecurityAuthenticatorException( - "OKerberosAuthenticator.createClientSubject() Client UseTicketCache cannot be true while Credential Cache is null"); + "OKerberosAuthenticator.createClientSubject() Client UseTicketCache cannot be true while" + + " Credential Cache is null"); if (clientCCName == null && clientKTName == null) throw new OSecurityAuthenticatorException( - "OKerberosAuthenticator.createClientSubject() Client Credential Cache and Client KeyTab cannot both be null"); + "OKerberosAuthenticator.createClientSubject() Client Credential Cache and Client KeyTab" + + " cannot both be null"); try { Configuration cfg = diff --git a/security/src/main/java/com/orientechnologies/security/ldap/OLDAPImporter.java b/security/src/main/java/com/orientechnologies/security/ldap/OLDAPImporter.java index 51036c619c4..33a8c5e9ea8 100755 --- a/security/src/main/java/com/orientechnologies/security/ldap/OLDAPImporter.java +++ b/security/src/main/java/com/orientechnologies/security/ldap/OLDAPImporter.java @@ -162,7 +162,8 @@ public void config(final ODocument importDoc, OSecuritySystem security) { OLogManager.instance() .error( this, - "Import LDAP Invalid server URL for database: %s, domain: %s, URL: %s", + "Import LDAP Invalid server URL for database: %s, domain: %s, URL:" + + " %s", null, dbName, domain, @@ -202,14 +203,16 @@ public void config(final ODocument importDoc, OSecuritySystem security) { OLogManager.instance() .error( this, - "Import LDAP The User's \"roles\" property is missing for database %s", + "Import LDAP The User's \"roles\" property is missing for" + + " database %s", null); } } else { OLogManager.instance() .error( this, - "Import LDAP The User's \"baseDN\" or \"filter\" property is missing for database %s", + "Import LDAP The User's \"baseDN\" or \"filter\" property is" + + " missing for database %s", null); } } @@ -223,14 +226,16 @@ public void config(final ODocument importDoc, OSecuritySystem security) { OLogManager.instance() .error( this, - "Import LDAP database %s \"domain\" is missing its \"servers\" property", + "Import LDAP database %s \"domain\" is missing its \"servers\"" + + " property", null); } } else { OLogManager.instance() .error( this, - "Import LDAP database %s \"domain\" object is missing its \"domain\" property", + "Import LDAP database %s \"domain\" object is missing its \"domain\"" + + " property", null); } } @@ -492,7 +497,8 @@ private synchronized void importLDAP() { OLogManager.instance() .info( this, - "OLDAPImporter.importLDAP() Calling retrieveUsers for Database: %s, Filter: %s", + "OLDAPImporter.importLDAP() Calling retrieveUsers for Database: %s," + + " Filter: %s", db.getName(), user.getFilter()); @@ -527,7 +533,8 @@ private synchronized void importLDAP() { OLogManager.instance() .info( this, - "OLDAPImporter.importLDAP() No users found at BaseDN: %s, Filter: %s, for Database: %s", + "OLDAPImporter.importLDAP() No users found at BaseDN: %s, Filter:" + + " %s, for Database: %s", user.getBaseDN(), user.getFilter(), db.getName()); @@ -540,7 +547,8 @@ private synchronized void importLDAP() { OLogManager.instance() .error( this, - "OLDAPImporter.importLDAP() Could not obtain an LDAP DirContext for Database %s", + "OLDAPImporter.importLDAP() Could not obtain an LDAP DirContext for" + + " Database %s", null, db.getName()); } @@ -548,7 +556,8 @@ private synchronized void importLDAP() { OLogManager.instance() .error( this, - "OLDAPImporter.importLDAP() Could not obtain an LDAP Subject for Database %s", + "OLDAPImporter.importLDAP() Could not obtain an LDAP Subject for Database" + + " %s", null, db.getName()); } @@ -602,7 +611,8 @@ private void retrieveLDAPUsers( OLogManager.instance() .error( this, - "OLDAPImporter.retrieveLDAPUsers() Roles is missing for entry Database: %s, Domain: %s", + "OLDAPImporter.retrieveLDAPUsers() Roles is missing for entry Database: %s," + + " Domain: %s", null, odb.getName(), domain); @@ -710,7 +720,8 @@ private boolean upsertDbUser(ODatabase db, String upn, Set roles) { StringBuilder sb = new StringBuilder(); sb.append( - "UPDATE OUser SET name = ?, password = ?, status = \"ACTIVE\", _externalUser = true, roles = (SELECT FROM ORole WHERE name in ["); + "UPDATE OUser SET name = ?, password = ?, status = \"ACTIVE\", _externalUser = true," + + " roles = (SELECT FROM ORole WHERE name in ["); String[] roleParams = new String[roles.size()]; diff --git a/security/src/main/java/com/orientechnologies/security/ldap/OLDAPLibrary.java b/security/src/main/java/com/orientechnologies/security/ldap/OLDAPLibrary.java index 2ffcdf474d1..6fa69a45dec 100755 --- a/security/src/main/java/com/orientechnologies/security/ldap/OLDAPLibrary.java +++ b/security/src/main/java/com/orientechnologies/security/ldap/OLDAPLibrary.java @@ -23,7 +23,7 @@ import java.util.List; import javax.naming.*; import javax.naming.NamingEnumeration; -import javax.naming.directory.*; // Attribute, Attributes, DirContext +import javax.naming.directory.*; import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; import javax.security.auth.Subject; diff --git a/security/src/main/java/com/orientechnologies/security/password/ODefaultPasswordValidator.java b/security/src/main/java/com/orientechnologies/security/password/ODefaultPasswordValidator.java index 82096ca9931..2b775c2008c 100755 --- a/security/src/main/java/com/orientechnologies/security/password/ODefaultPasswordValidator.java +++ b/security/src/main/java/com/orientechnologies/security/password/ODefaultPasswordValidator.java @@ -104,7 +104,8 @@ public void validatePassword(final String username, final String password) OLogManager.instance() .debug( this, - "ODefaultPasswordValidator.validatePassword() Password requires a minimum count of numbers"); + "ODefaultPasswordValidator.validatePassword() Password requires a minimum count of" + + " numbers"); throw new OInvalidPasswordException("Password requires a minimum count of numbers"); } @@ -112,7 +113,8 @@ public void validatePassword(final String username, final String password) OLogManager.instance() .debug( this, - "ODefaultPasswordValidator.validatePassword() Password requires a minimum count of special characters"); + "ODefaultPasswordValidator.validatePassword() Password requires a minimum count of" + + " special characters"); throw new OInvalidPasswordException( "Password requires a minimum count of special characters"); } @@ -121,7 +123,8 @@ public void validatePassword(final String username, final String password) OLogManager.instance() .debug( this, - "ODefaultPasswordValidator.validatePassword() Password requires a minimum count of uppercase characters"); + "ODefaultPasswordValidator.validatePassword() Password requires a minimum count of" + + " uppercase characters"); throw new OInvalidPasswordException( "Password requires a minimum count of uppercase characters"); } diff --git a/server/pom.xml b/server/pom.xml index 08d81bace45..da8fe272c4c 100755 --- a/server/pom.xml +++ b/server/pom.xml @@ -30,6 +30,8 @@ ${maven.compiler.target} com.orientechnologies.orient.server.OServerMain UTF-8 + + 2023-01-01T00:00:00Z @@ -62,19 +64,20 @@ jaxb-runtime 3.0.2 + - org.bouncycastle - bcpkix-jdk15on - 1.70 - - + org.bouncycastle + bcpkix-jdk18on + 1.77 + + - org.apache.httpcomponents - httpclient - 4.5.14 + org.apache.httpcomponents.client5 + httpclient5 + 5.3.1 test - - + + org.apache.httpcomponents fluent-hc 4.5.14 diff --git a/server/src/main/java/com/orientechnologies/orient/server/OConnectionBinaryExecutor.java b/server/src/main/java/com/orientechnologies/orient/server/OConnectionBinaryExecutor.java index eee9a1b8985..b8d74784f6c 100755 --- a/server/src/main/java/com/orientechnologies/orient/server/OConnectionBinaryExecutor.java +++ b/server/src/main/java/com/orientechnologies/orient/server/OConnectionBinaryExecutor.java @@ -262,7 +262,8 @@ public OBinaryResponse executeDropCluster(ODropClusterRequest request) { throw new IllegalArgumentException( "Cluster " + request.getClusterId() - + " does not exist anymore. Refresh the db structure or just reconnect to the database"); + + " does not exist anymore. Refresh the db structure or just reconnect to the" + + " database"); boolean result = connection.getDatabase().dropCluster(clusterName); return new ODropClusterResponse(result); @@ -1006,7 +1007,8 @@ public OBinaryResponse executeConnect(OConnectRequest request) { OBinaryProtocolHelper.checkProtocolVersion(this, request.getProtocolVersion()); if (request.getProtocolVersion() > 36) throw new OConfigurationException( - "You can use connect as first operation only for protocol < 37 please use handshake for protocol >= 37"); + "You can use connect as first operation only for protocol < 37 please use handshake for" + + " protocol >= 37"); connection.getData().driverName = request.getDriverName(); connection.getData().driverVersion = request.getDriverVersion(); connection.getData().protocolVersion = request.getProtocolVersion(); @@ -1022,9 +1024,11 @@ public OBinaryResponse executeConnect(OConnectRequest request) { OLogManager.instance() .warn( this, - "Session open with token flag false is not supported anymore please use token based sessions"); + "Session open with token flag false is not supported anymore please use token based" + + " sessions"); throw new OConfigurationException( - "Session open with token flag false is not supported anymore please use token based sessions"); + "Session open with token flag false is not supported anymore please use token based" + + " sessions"); } connection.setServerUser( @@ -1082,7 +1086,8 @@ public OBinaryResponse executeDatabaseOpen(OOpenRequest request) { OBinaryProtocolHelper.checkProtocolVersion(this, request.getProtocolVersion()); if (request.getProtocolVersion() > 36) throw new OConfigurationException( - "You can use open as first operation only for protocol < 37 please use handshake for protocol >= 37"); + "You can use open as first operation only for protocol < 37 please use handshake for" + + " protocol >= 37"); connection.getData().driverName = request.getDriverName(); connection.getData().driverVersion = request.getDriverVersion(); connection.getData().protocolVersion = request.getProtocolVersion(); @@ -1093,9 +1098,11 @@ public OBinaryResponse executeDatabaseOpen(OOpenRequest request) { OLogManager.instance() .warn( this, - "Session open with token flag false is not supported anymore please use token based sessions"); + "Session open with token flag false is not supported anymore please use token based" + + " sessions"); throw new OConfigurationException( - "Session open with token flag false is not supported anymore please use token based sessions"); + "Session open with token flag false is not supported anymore please use token based" + + " sessions"); } connection.setTokenBased(request.isUseToken()); connection.getData().supportsLegacyPushMessages = request.isSupportsPush(); diff --git a/server/src/main/java/com/orientechnologies/orient/server/OServer.java b/server/src/main/java/com/orientechnologies/orient/server/OServer.java index 4fb18e47aea..cb3d3de374d 100755 --- a/server/src/main/java/com/orientechnologies/orient/server/OServer.java +++ b/server/src/main/java/com/orientechnologies/orient/server/OServer.java @@ -113,8 +113,8 @@ public OServer(boolean shutdownEngineOnExit) { OLogManager.instance() .warnNoDb( this, - "OrientDB instance is running inside of web application, " - + "it is highly unrecommended to force to shutdown OrientDB engine on server shutdown"); + "OrientDB instance is running inside of web application, it is highly unrecommended" + + " to force to shutdown OrientDB engine on server shutdown"); } this.shutdownEngineOnExit = shutdownEngineOnExit; @@ -228,8 +228,12 @@ public void saveConfiguration() throws IOException { } public void restart() - throws ClassNotFoundException, InvocationTargetException, InstantiationException, - NoSuchMethodException, IllegalAccessException, IOException { + throws ClassNotFoundException, + InvocationTargetException, + InstantiationException, + NoSuchMethodException, + IllegalAccessException, + IOException { try { deinit(); } finally { @@ -674,7 +678,8 @@ private boolean askForEncryptionKey(final String iDatabaseName) { System.out.println(); System.out.println( OAnsiCode.format( - "$ANSI{yellow +--------------------------------------------------------------------------+}")); + "$ANSI{yellow" + + " +--------------------------------------------------------------------------+}")); System.out.println( OAnsiCode.format( String.format( @@ -682,16 +687,20 @@ private boolean askForEncryptionKey(final String iDatabaseName) { "'" + iDatabaseName + "'"))); System.out.println( OAnsiCode.format( - "$ANSI{yellow +--------------------------------------------------------------------------+}")); + "$ANSI{yellow" + + " +--------------------------------------------------------------------------+}")); System.out.println( OAnsiCode.format( - "$ANSI{yellow | To avoid this message set the environment variable or JVM setting |}")); + "$ANSI{yellow | To avoid this message set the environment variable or JVM setting " + + " |}")); System.out.println( OAnsiCode.format( - "$ANSI{yellow | 'storage.encryptionKey' to the key to use. |}")); + "$ANSI{yellow | 'storage.encryptionKey' to the key to use. " + + " |}")); System.out.println( OAnsiCode.format( - "$ANSI{yellow +--------------------------------------------------------------------------+}")); + "$ANSI{yellow" + + " +--------------------------------------------------------------------------+}")); System.out.print( OAnsiCode.format("\n$ANSI{yellow Database encryption key [BLANK=to skip opening]: }")); @@ -1017,7 +1026,8 @@ protected void createDefaultServerUsers() throws IOException { if (!rootPassword.equals(rootConfirmPassword)) { System.out.println( OAnsiCode.format( - "$ANSI{red ERROR: Passwords don't match, please reinsert both of them, or press ENTER to auto generate it}")); + "$ANSI{red ERROR: Passwords don't match, please reinsert both of them, or press" + + " ENTER to auto generate it}")); } else // PASSWORDS MATCH diff --git a/server/src/main/java/com/orientechnologies/orient/server/OServerShutdownMain.java b/server/src/main/java/com/orientechnologies/orient/server/OServerShutdownMain.java index 6cfab8f7469..fbbcc88e5f9 100755 --- a/server/src/main/java/com/orientechnologies/orient/server/OServerShutdownMain.java +++ b/server/src/main/java/com/orientechnologies/orient/server/OServerShutdownMain.java @@ -111,7 +111,8 @@ public static void main(final String[] iArgs) { if ("NOT_PRESENT".equals(rootPassword) || printUsage) { System.out.println("allowed parameters"); System.out.println( - "-h | --host hostname : name or ip of the host where OrientDB is running. Deafult to localhost "); + "-h | --host hostname : name or ip of the host where OrientDB is running. Deafult to" + + " localhost "); System.out.println( "-P | --ports ports : ports in the form of single value or range. Default to 2424-2430"); System.out.println("-p | --password password : the super user password"); diff --git a/server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedMessageService.java b/server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedMessageService.java index 8868a9575cb..3eb04093948 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedMessageService.java +++ b/server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedMessageService.java @@ -22,7 +22,9 @@ import com.orientechnologies.orient.core.record.impl.ODocument; import java.util.Set; -/** @author Luca Garulli (l.garulli--at--orientdb.com) */ +/** + * @author Luca Garulli (l.garulli--at--orientdb.com) + */ public interface ODistributedMessageService { Set getDatabases(); diff --git a/server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedRequest.java b/server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedRequest.java index 4b2f4fac007..4e834e07e36 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedRequest.java +++ b/server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedRequest.java @@ -25,7 +25,9 @@ import java.io.DataOutput; import java.io.IOException; -/** @author Luca Garulli (l.garulli--(at)--orientdb.com) */ +/** + * @author Luca Garulli (l.garulli--(at)--orientdb.com) + */ public class ODistributedRequest { public enum EXECUTION_MODE { RESPONSE, diff --git a/server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedResponse.java b/server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedResponse.java index 84119f5c8b9..33a6c293d5d 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedResponse.java +++ b/server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedResponse.java @@ -25,7 +25,9 @@ import java.io.IOException; import java.util.Arrays; -/** @author Luca Garulli (l.garulli--(at)--orientdb.com) */ +/** + * @author Luca Garulli (l.garulli--(at)--orientdb.com) + */ public class ODistributedResponse { private ODistributedResponseManager distributedResponseManager; private ODistributedRequestId requestId; diff --git a/server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedResponseManagerImpl.java b/server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedResponseManagerImpl.java index 6ddfece1eef..160f2bca409 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedResponseManagerImpl.java +++ b/server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedResponseManagerImpl.java @@ -749,7 +749,9 @@ protected boolean checkNoWinnerCase(final List bestRespons dManager.getLocalNodeName(), null, DIRECTION.NONE, - "Detected possible split brain network where 2 groups of servers A%s and B%s have different contents. Cannot decide who is the winner even if the quorum (%d) has been reached. Request (%s) responses:%s", + "Detected possible split brain network where 2 groups of servers A%s and B%s have" + + " different contents. Cannot decide who is the winner even if the quorum (%d) has" + + " been reached. Request (%s) responses:%s", a, b, quorum, diff --git a/server/src/main/java/com/orientechnologies/orient/server/handler/OAutomaticBackup.java b/server/src/main/java/com/orientechnologies/orient/server/handler/OAutomaticBackup.java index 87f68890a23..181fe689b24 100755 --- a/server/src/main/java/com/orientechnologies/orient/server/handler/OAutomaticBackup.java +++ b/server/src/main/java/com/orientechnologies/orient/server/handler/OAutomaticBackup.java @@ -155,7 +155,8 @@ else if (param.name.equalsIgnoreCase("exportOptions")) OLogManager.instance() .info( this, - "Automatic Backup plugin installed and active: delay=%dms, firstTime=%s, targetDirectory=%s", + "Automatic Backup plugin installed and active: delay=%dms, firstTime=%s," + + " targetDirectory=%s", delay, firstTime, targetDirectory); diff --git a/server/src/main/java/com/orientechnologies/orient/server/handler/OConfigurableHooksManager.java b/server/src/main/java/com/orientechnologies/orient/server/handler/OConfigurableHooksManager.java index a8bd6fc2a71..55c0f765575 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/handler/OConfigurableHooksManager.java +++ b/server/src/main/java/com/orientechnologies/orient/server/handler/OConfigurableHooksManager.java @@ -106,7 +106,9 @@ public void onOpen(ODatabaseInternal iDatabase) { OLogManager.instance() .warn( this, - "[configure] Failed to configure hook '%s'. Parameters specified but hook don support parameters. Should have a method config with parameters OServerParameterConfiguration[] ", + "[configure] Failed to configure hook '%s'. Parameters specified but hook don" + + " support parameters. Should have a method config with parameters" + + " OServerParameterConfiguration[] ", hook.clazz); } db.registerHook(h, pos); diff --git a/server/src/main/java/com/orientechnologies/orient/server/handler/OServerSideScriptInterpreter.java b/server/src/main/java/com/orientechnologies/orient/server/handler/OServerSideScriptInterpreter.java index 1fb7b91500b..b6d7805f059 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/handler/OServerSideScriptInterpreter.java +++ b/server/src/main/java/com/orientechnologies/orient/server/handler/OServerSideScriptInterpreter.java @@ -103,7 +103,8 @@ public void startup() { OLogManager.instance() .warn( this, - "Authenticated clients can execute any kind of code into the server by using the following allowed languages: " + "Authenticated clients can execute any kind of code into the server by using the" + + " following allowed languages: " + allowedLanguages); } diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/OServerNetworkListener.java b/server/src/main/java/com/orientechnologies/orient/server/network/OServerNetworkListener.java index c861f9f18e2..ffa51b37e0c 100755 --- a/server/src/main/java/com/orientechnologies/orient/server/network/OServerNetworkListener.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/OServerNetworkListener.java @@ -223,7 +223,8 @@ public void run() { OLogManager.instance() .warn( this, - "Reached maximum number of concurrent connections (max=%d, current=%d), reject incoming connection from %s", + "Reached maximum number of concurrent connections (max=%d, current=%d)," + + " reject incoming connection from %s", max, conns, socket.getRemoteSocketAddress()); diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/OServerSSLCertificateManager.java b/server/src/main/java/com/orientechnologies/orient/server/network/OServerSSLCertificateManager.java index f67e42a3ef0..2fa4dc24e97 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/OServerSSLCertificateManager.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/OServerSSLCertificateManager.java @@ -135,8 +135,12 @@ private void initOSelfSignedCertificateParameters() { public static OSelfSignedCertificate autoGenerateSelfSignedX509Cerificate( OSelfSignedCertificate oCert) - throws SwitchToDefaultParamsException, NoSuchAlgorithmException, CertificateException, - NoSuchProviderException, InvalidKeyException, SignatureException { + throws SwitchToDefaultParamsException, + NoSuchAlgorithmException, + CertificateException, + NoSuchProviderException, + InvalidKeyException, + SignatureException { oCert.generateCertificateKeyPair(); oCert.composeSelfSignedCertificate(); oCert.checkThisCertificate(); diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/binary/ONetworkProtocolBinary.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/binary/ONetworkProtocolBinary.java index fa248550805..5bde433e553 100755 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/binary/ONetworkProtocolBinary.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/binary/ONetworkProtocolBinary.java @@ -632,7 +632,8 @@ protected void checkServerAccess(final String iResource, OClientConnection conne + connection.getServerUser().getName() + "' cannot access to the resource [" + iResource - + "]. Use another server user or change permission in the file config/orientdb-server-config.xml"); + + "]. Use another server user or change permission in the file" + + " config/orientdb-server-config.xml"); } else { if (!connection.getData().serverUser) throw new OSecurityAccessException("Server user not authenticated"); @@ -643,7 +644,8 @@ protected void checkServerAccess(final String iResource, OClientConnection conne + connection.getData().serverUsername + "' cannot access to the resource [" + iResource - + "]. Use another server user or change permission in the file config/orientdb-server-config.xml"); + + "]. Use another server user or change permission in the file" + + " config/orientdb-server-config.xml"); } } diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/OHttpResponseWrapper.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/OHttpResponseWrapper.java index 8628d9fe41c..6e73cdded7b 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/OHttpResponseWrapper.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/OHttpResponseWrapper.java @@ -35,7 +35,9 @@ public class OHttpResponseWrapper { private final OHttpResponse response; - /** @param iResponse */ + /** + * @param iResponse + */ public OHttpResponseWrapper(final OHttpResponse iResponse) { response = iResponse; } diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/OServerCommandAuthProxy.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/OServerCommandAuthProxy.java index c9dba0069e4..0a4b6197667 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/OServerCommandAuthProxy.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/OServerCommandAuthProxy.java @@ -23,7 +23,9 @@ import com.orientechnologies.orient.server.network.protocol.http.OHttpUtils; import java.util.Arrays; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OServerCommandAuthProxy extends OServerCommandPatternAbstract { public static final String DATABASE_CONF = "database"; diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/OServerCommandAuthenticatedDbAbstract.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/OServerCommandAuthenticatedDbAbstract.java index b6ae8cb58f7..31bf125272a 100755 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/OServerCommandAuthenticatedDbAbstract.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/OServerCommandAuthenticatedDbAbstract.java @@ -143,7 +143,8 @@ public boolean beforeExecute(final OHttpRequest iRequest, OHttpResponse iRespons OLogManager.instance() .warn( this, - "Session %s is trying to access to the database '%s', but has been authenticated against the database '%s'", + "Session %s is trying to access to the database '%s', but has been authenticated" + + " against the database '%s'", iRequest.getSessionId(), iRequest.getDatabaseName(), currentSession.getDatabaseName()); @@ -158,7 +159,8 @@ public boolean beforeExecute(final OHttpRequest iRequest, OHttpResponse iRespons OLogManager.instance() .warn( this, - "Session %s is trying to access to the database '%s' with user '%s', but has been authenticated with user '%s'", + "Session %s is trying to access to the database '%s' with user '%s', but has been" + + " authenticated with user '%s'", iRequest.getSessionId(), iRequest.getDatabaseName(), authenticationParts.get(0), diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetCluster.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetCluster.java index 33490d3526c..cf2f968f886 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetCluster.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetCluster.java @@ -38,7 +38,8 @@ public boolean execute(final OHttpRequest iRequest, OHttpResponse iResponse) thr checkSyntax( iRequest.getUrl(), 3, - "Syntax error: cluster//[/]
    Limit is optional and is setted to 20 by default. Set expressely to 0 to have no limits."); + "Syntax error: cluster//[/]
    Limit is optional and is" + + " setted to 20 by default. Set expressely to 0 to have no limits."); iRequest.getData().commandInfo = "Browse cluster"; iRequest.getData().commandDetail = urlParts[2]; diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetFileDownload.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetFileDownload.java index f0f8a20acd6..a5860b5954b 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetFileDownload.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetFileDownload.java @@ -31,7 +31,9 @@ import java.io.IOException; import java.util.Date; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OServerCommandGetFileDownload extends OServerCommandAuthenticatedDbAbstract { private static final String[] NAMES = {"GET|fileDownload/*"}; diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetGephi.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetGephi.java index a764e469b2a..cc39f3ea612 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetGephi.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetGephi.java @@ -51,7 +51,9 @@ public boolean execute(final OHttpRequest iRequest, OHttpResponse iResponse) thr checkSyntax( iRequest.getUrl(), 4, - "Syntax error: gephi///[/][/].
    Limit is optional and is set to 20 by default. Set to 0 to have no limits."); + "Syntax error:" + + " gephi///[/][/].
    Limit is" + + " optional and is set to 20 by default. Set to 0 to have no limits."); final String language = urlParts[2]; final String text = urlParts[3]; diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetQuery.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetQuery.java index 15799076165..a5beec87d83 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetQuery.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetQuery.java @@ -41,7 +41,8 @@ public boolean execute(final OHttpRequest iRequest, OHttpResponse iResponse) thr checkSyntax( iRequest.getUrl(), 4, - "Syntax error: query//sql/[/][/].
    Limit is optional and is set to 20 by default. Set to 0 to have no limits."); + "Syntax error: query//sql/[/][/].
    Limit is" + + " optional and is set to 20 by default. Set to 0 to have no limits."); int limit = urlParts.length > 4 ? Integer.parseInt(urlParts[4]) : 20; String fetchPlan = urlParts.length > 5 ? urlParts[5] : null; diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetStaticContent.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetStaticContent.java index 769349b3605..8596a776ee3 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetStaticContent.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetStaticContent.java @@ -253,7 +253,8 @@ private void loadStaticContent( OLogManager.instance() .warn( this, - "No path configured. Specify the 'root.path', 'file.path' or the global 'orientdb.www.path' variable", + "No path configured. Specify the 'root.path', 'file.path' or the global" + + " 'orientdb.www.path' variable", rootPath); return; } diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/options/OServerCommandOptions.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/options/OServerCommandOptions.java index 1aa56ed7155..fdcc5739151 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/options/OServerCommandOptions.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/options/OServerCommandOptions.java @@ -39,7 +39,10 @@ public boolean execute(final OHttpRequest iRequest, OHttpResponse iResponse) thr OHttpUtils.STATUS_OK_DESCRIPTION, OHttpUtils.CONTENT_TEXT_PLAIN, null, - "Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS\r\nAccess-Control-Max-Age: 1728000\r\nAccess-Control-Allow-Headers: if-modified-since, content-type, authorization, x-requested-with"); + "Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS\r\n" + + "Access-Control-Max-Age: 1728000\r\n" + + "Access-Control-Allow-Headers: if-modified-since, content-type, authorization," + + " x-requested-with"); return false; } diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/post/OServerCommandPostBatch.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/post/OServerCommandPostBatch.java index 8de006c4482..d80537cef91 100755 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/post/OServerCommandPostBatch.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/post/OServerCommandPostBatch.java @@ -101,7 +101,8 @@ public boolean execute(final OHttpRequest iRequest, OHttpResponse iResponse) thr OLogManager.instance() .warn( this, - "Found database instance from the pool with a pending transaction. Forcing rollback before using it"); + "Found database instance from the pool with a pending transaction. Forcing rollback" + + " before using it"); db.rollback(true); } diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/post/OServerCommandPostImportDatabase.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/post/OServerCommandPostImportDatabase.java index 0a886746b96..aaeeb11e9c0 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/post/OServerCommandPostImportDatabase.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/post/OServerCommandPostImportDatabase.java @@ -32,7 +32,9 @@ import java.util.HashMap; import java.util.Map; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OServerCommandPostImportDatabase extends OHttpMultipartRequestCommand implements OCommandOutputListener { @@ -57,7 +59,8 @@ public boolean execute(final OHttpRequest iRequest, OHttpResponse iResponse) thr OHttpUtils.STATUS_OK_CODE, OHttpUtils.STATUS_OK_DESCRIPTION, OHttpUtils.CONTENT_JSON, - "{\"responseText\": \"Database imported Correctly, see server log for more informations.\"}", + "{\"responseText\": \"Database imported Correctly, see server log for more" + + " informations.\"}", null); } catch (Exception e) { iResponse.send( @@ -101,7 +104,8 @@ public boolean execute(final OHttpRequest iRequest, OHttpResponse iResponse) thr OHttpUtils.STATUS_OK_CODE, OHttpUtils.STATUS_OK_DESCRIPTION, OHttpUtils.CONTENT_JSON, - "{\"responseText\": \"Database imported Correctly, see server log for more informations.\"}", + "{\"responseText\": \"Database imported Correctly, see server log for more" + + " informations.\"}", null); } catch (Exception e) { iResponse.send( diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/post/OServerCommandPostImportRecords.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/post/OServerCommandPostImportRecords.java index 3b4cd90eaa1..dc74595a2c6 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/post/OServerCommandPostImportRecords.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/post/OServerCommandPostImportRecords.java @@ -48,7 +48,8 @@ public boolean execute(final OHttpRequest iRequest, OHttpResponse iResponse) thr checkSyntax( iRequest.getUrl(), 4, - "Syntax error: importRecords///[/][/][/]"); + "Syntax error:" + + " importRecords///[/][/][/]"); final long start = System.currentTimeMillis(); @@ -138,7 +139,10 @@ public boolean execute(final OHttpRequest iRequest, OHttpResponse iResponse) thr String message = String.format( - "Import of records of class '%s' completed in %5.3f seconds. Line parsed: %d, imported: %d, error: %d\nDetailed messages:\n%s", + "Import of records of class '%s' completed in %5.3f seconds. Line parsed: %d," + + " imported: %d, error: %d\n" + + "Detailed messages:\n" + + "%s", cls.getName(), elapsed, line, imported, errors, output); iResponse.send( diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/post/OServerCommandPostProperty.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/post/OServerCommandPostProperty.java index 711a15fcbc0..298d71cf135 100755 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/post/OServerCommandPostProperty.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/post/OServerCommandPostProperty.java @@ -60,7 +60,8 @@ protected boolean addSingleProperty( checkSyntax( iRequest.getUrl(), 4, - "Syntax error: property////[]/[]"); + "Syntax error:" + + " property////[]/[]"); iRequest.getData().commandInfo = "Create property"; iRequest.getData().commandDetail = urlParts[2] + "." + urlParts[3]; @@ -95,7 +96,8 @@ protected boolean addSingleProperty( throw new IllegalArgumentException( "linked type declared as " + urlParts[5] - + " can be either a Type or a Class, use the JSON document usage instead. See 'http://code.google.com/p/orient/w/edit/OrientDB_REST'"); + + " can be either a Type or a Class, use the JSON document usage instead." + + " See 'http://code.google.com/p/orient/w/edit/OrientDB_REST'"); } } } diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/post/OServerCommandPostUploadSingleFile.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/post/OServerCommandPostUploadSingleFile.java index f2d732f225e..53233bf4ce3 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/post/OServerCommandPostUploadSingleFile.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/post/OServerCommandPostUploadSingleFile.java @@ -32,7 +32,9 @@ import java.util.Calendar; import java.util.HashMap; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OServerCommandPostUploadSingleFile extends OHttpMultipartRequestCommand { private static final String[] NAMES = {"POST|uploadSingleFile/*"}; diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartBaseInputStream.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartBaseInputStream.java index 061855e64d5..274b639fd4e 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartBaseInputStream.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartBaseInputStream.java @@ -19,7 +19,9 @@ import java.io.InputStream; import java.util.ArrayList; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OHttpMultipartBaseInputStream extends InputStream { protected ArrayList buffer; diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartContentBaseParser.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartContentBaseParser.java index b6b9ec7c8ad..d81aa96dabd 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartContentBaseParser.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartContentBaseParser.java @@ -20,7 +20,9 @@ import java.io.IOException; import java.util.Map; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OHttpMultipartContentBaseParser implements OHttpMultipartContentParser { @Override diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartContentInputStream.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartContentInputStream.java index 044a811d83b..18ebc203819 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartContentInputStream.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartContentInputStream.java @@ -19,7 +19,9 @@ import java.io.InputStream; import java.util.ArrayList; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OHttpMultipartContentInputStream extends InputStream { protected String boundary; diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartContentParser.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartContentParser.java index 0e44a52675a..704c6f717ad 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartContentParser.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartContentParser.java @@ -20,7 +20,9 @@ import java.io.IOException; import java.util.Map; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public interface OHttpMultipartContentParser { public T parse( diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartDatabaseImportContentParser.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartDatabaseImportContentParser.java index 9543baf6dd7..b9c18b1a122 100755 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartDatabaseImportContentParser.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartDatabaseImportContentParser.java @@ -23,7 +23,9 @@ import java.util.Map; import java.util.zip.GZIPInputStream; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OHttpMultipartDatabaseImportContentParser implements OHttpMultipartContentParser { diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartFileToDiskContentParser.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartFileToDiskContentParser.java index d8c72eeecc6..d2fbfc79bd0 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartFileToDiskContentParser.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartFileToDiskContentParser.java @@ -29,7 +29,9 @@ import java.io.StringWriter; import java.util.Map; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OHttpMultipartFileToDiskContentParser implements OHttpMultipartContentParser { diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartFileToRecordContentParser.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartFileToRecordContentParser.java index 678bef63366..cdab22fa7fa 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartFileToRecordContentParser.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartFileToRecordContentParser.java @@ -23,7 +23,9 @@ import java.io.IOException; import java.util.Map; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OHttpMultipartFileToRecordContentParser implements OHttpMultipartContentParser { @Override diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartHelper.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartHelper.java index 04a2b48ea29..c7d3410394f 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartHelper.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartHelper.java @@ -19,7 +19,9 @@ import com.orientechnologies.orient.server.network.protocol.http.OHttpUtils; import java.io.IOException; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class OHttpMultipartHelper { protected static boolean isMultipartPartHeader(StringBuilder header) { diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartRequestCommand.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartRequestCommand.java index 997ab30fbac..403e7cfe972 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartRequestCommand.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/multipart/OHttpMultipartRequestCommand.java @@ -24,7 +24,9 @@ import java.util.HashMap; import java.util.LinkedHashMap; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public abstract class OHttpMultipartRequestCommand extends OServerCommandAuthenticatedDbAbstract { diff --git a/server/src/main/java/com/orientechnologies/orient/server/plugin/mail/OMailProfile.java b/server/src/main/java/com/orientechnologies/orient/server/plugin/mail/OMailProfile.java index 9d6a0b10c0b..fab670e2d35 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/plugin/mail/OMailProfile.java +++ b/server/src/main/java/com/orientechnologies/orient/server/plugin/mail/OMailProfile.java @@ -22,5 +22,7 @@ import java.util.Properties; -/** @author Luca Garulli (l.garulli--(at)--orientdb.com) */ +/** + * @author Luca Garulli (l.garulli--(at)--orientdb.com) + */ public class OMailProfile extends Properties {} diff --git a/server/src/main/java/com/orientechnologies/orient/server/security/OSelfSignedCertificate.java b/server/src/main/java/com/orientechnologies/orient/server/security/OSelfSignedCertificate.java index 4ec1fcfdec1..5c3a566c03a 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/security/OSelfSignedCertificate.java +++ b/server/src/main/java/com/orientechnologies/orient/server/security/OSelfSignedCertificate.java @@ -240,15 +240,21 @@ public X509Certificate getCertificate() throws CertificateException { } public static void checkCertificate(X509Certificate cert, PublicKey publicKey, Date date) - throws NoSuchProviderException, CertificateException, NoSuchAlgorithmException, - InvalidKeyException, SignatureException { + throws NoSuchProviderException, + CertificateException, + NoSuchAlgorithmException, + InvalidKeyException, + SignatureException { cert.checkValidity(date); cert.verify(publicKey); } public void checkThisCertificate() - throws NoSuchAlgorithmException, CertificateException, NoSuchProviderException, - InvalidKeyException, SignatureException { + throws NoSuchAlgorithmException, + CertificateException, + NoSuchProviderException, + InvalidKeyException, + SignatureException { checkCertificate( this.certificate, this.keyPair.getPublic(), new Date(System.currentTimeMillis())); } diff --git a/server/src/test/java/com/orientechnologies/orient/core/db/OSequenceRemoteTest.java b/server/src/test/java/com/orientechnologies/orient/core/db/OSequenceRemoteTest.java index 971633660a7..8cbc24d6774 100644 --- a/server/src/test/java/com/orientechnologies/orient/core/db/OSequenceRemoteTest.java +++ b/server/src/test/java/com/orientechnologies/orient/core/db/OSequenceRemoteTest.java @@ -32,7 +32,8 @@ public void shouldSequenceWithDefaultValueNoTx() { db.command("CREATE CLASS Person EXTENDS V"); db.command("CREATE SEQUENCE personIdSequence TYPE ORDERED;"); db.command( - "CREATE PROPERTY Person.id LONG (MANDATORY TRUE, default \"sequence('personIdSequence').next()\");"); + "CREATE PROPERTY Person.id LONG (MANDATORY TRUE, default" + + " \"sequence('personIdSequence').next()\");"); db.command("CREATE INDEX Person.id ON Person (id) UNIQUE"); db.getMetadata().reload(); @@ -52,7 +53,8 @@ public void shouldSequenceWithDefaultValueTx() { db.command("CREATE CLASS Person EXTENDS V"); db.command("CREATE SEQUENCE personIdSequence TYPE ORDERED;"); db.command( - "CREATE PROPERTY Person.id LONG (MANDATORY TRUE, default \"sequence('personIdSequence').next()\");"); + "CREATE PROPERTY Person.id LONG (MANDATORY TRUE, default" + + " \"sequence('personIdSequence').next()\");"); db.command("CREATE INDEX Person.id ON Person (id) UNIQUE"); db.getMetadata().reload(); diff --git a/server/src/test/java/com/orientechnologies/orient/core/db/OrientDBRemoteTest.java b/server/src/test/java/com/orientechnologies/orient/core/db/OrientDBRemoteTest.java index aa874c64431..01189c72244 100755 --- a/server/src/test/java/com/orientechnologies/orient/core/db/OrientDBRemoteTest.java +++ b/server/src/test/java/com/orientechnologies/orient/core/db/OrientDBRemoteTest.java @@ -100,7 +100,8 @@ public void testPool() { public void testCachedPool() { if (!factory.exists("testdb")) factory.execute( - "create database testdb memory users (admin identified by 'admin' role admin, reader identified by 'reader' role reader, writer identified by 'writer' role writer)"); + "create database testdb memory users (admin identified by 'admin' role admin, reader" + + " identified by 'reader' role reader, writer identified by 'writer' role writer)"); ODatabasePool poolAdmin1 = factory.cachedPool("testdb", "admin", "admin"); ODatabasePool poolAdmin2 = factory.cachedPool("testdb", "admin", "admin"); @@ -153,7 +154,8 @@ public void testCachedPoolFactoryCleanUp() throws Exception { public void testMultiThread() { if (!factory.exists("test")) factory.execute( - "create database test memory users (admin identified by 'admin' role admin, reader identified by 'reader' role reader, writer identified by 'writer' role writer)"); + "create database test memory users (admin identified by 'admin' role admin, reader" + + " identified by 'reader' role reader, writer identified by 'writer' role writer)"); ODatabasePool pool = new ODatabasePool(factory, "test", "admin", "admin"); diff --git a/server/src/test/java/com/orientechnologies/orient/server/HookInstallServerTest.java b/server/src/test/java/com/orientechnologies/orient/server/HookInstallServerTest.java index 10a6736d216..db7adeadb53 100755 --- a/server/src/test/java/com/orientechnologies/orient/server/HookInstallServerTest.java +++ b/server/src/test/java/com/orientechnologies/orient/server/HookInstallServerTest.java @@ -45,10 +45,18 @@ public void onRecordAfterCreate(ODocument iDocument) { @Before public void before() - throws MalformedObjectNameException, InstanceAlreadyExistsException, - MBeanRegistrationException, NotCompliantMBeanException, ClassNotFoundException, - NullPointerException, IOException, IllegalArgumentException, SecurityException, - InvocationTargetException, NoSuchMethodException, InstantiationException, + throws MalformedObjectNameException, + InstanceAlreadyExistsException, + MBeanRegistrationException, + NotCompliantMBeanException, + ClassNotFoundException, + NullPointerException, + IOException, + IllegalArgumentException, + SecurityException, + InvocationTargetException, + NoSuchMethodException, + InstantiationException, IllegalAccessException { server = new OServer(false); server.setServerRootDirectory(SERVER_DIRECTORY); diff --git a/server/src/test/java/com/orientechnologies/orient/server/OServerDatabaseOperationsTest.java b/server/src/test/java/com/orientechnologies/orient/server/OServerDatabaseOperationsTest.java index 6f6831febee..62a9b08cc0e 100755 --- a/server/src/test/java/com/orientechnologies/orient/server/OServerDatabaseOperationsTest.java +++ b/server/src/test/java/com/orientechnologies/orient/server/OServerDatabaseOperationsTest.java @@ -32,9 +32,16 @@ public class OServerDatabaseOperationsTest { @Before public void before() - throws ClassNotFoundException, MalformedObjectNameException, InstanceAlreadyExistsException, - NotCompliantMBeanException, MBeanRegistrationException, NoSuchMethodException, - IOException, InvocationTargetException, IllegalAccessException, InstantiationException { + throws ClassNotFoundException, + MalformedObjectNameException, + InstanceAlreadyExistsException, + NotCompliantMBeanException, + MBeanRegistrationException, + NoSuchMethodException, + IOException, + InvocationTargetException, + IllegalAccessException, + InstantiationException { OLogManager.instance().setConsoleLevel(Level.OFF.getName()); OServerConfiguration conf = new OServerConfiguration(); diff --git a/server/src/test/java/com/orientechnologies/orient/server/SocketIdleCleanupIT.java b/server/src/test/java/com/orientechnologies/orient/server/SocketIdleCleanupIT.java index e8a86073a64..d407924c190 100644 --- a/server/src/test/java/com/orientechnologies/orient/server/SocketIdleCleanupIT.java +++ b/server/src/test/java/com/orientechnologies/orient/server/SocketIdleCleanupIT.java @@ -28,9 +28,16 @@ public class SocketIdleCleanupIT { @Before public void before() - throws IOException, InstantiationException, InvocationTargetException, NoSuchMethodException, - MBeanRegistrationException, IllegalAccessException, InstanceAlreadyExistsException, - NotCompliantMBeanException, ClassNotFoundException, MalformedObjectNameException { + throws IOException, + InstantiationException, + InvocationTargetException, + NoSuchMethodException, + MBeanRegistrationException, + IllegalAccessException, + InstanceAlreadyExistsException, + NotCompliantMBeanException, + ClassNotFoundException, + MalformedObjectNameException { String classpath = System.getProperty("java.class.path"); System.out.println("Class path " + classpath); server = diff --git a/server/src/test/java/com/orientechnologies/orient/server/handler/AutomaticBackupTest.java b/server/src/test/java/com/orientechnologies/orient/server/handler/AutomaticBackupTest.java index 0f11dd46fd7..d948ab5b5a9 100755 --- a/server/src/test/java/com/orientechnologies/orient/server/handler/AutomaticBackupTest.java +++ b/server/src/test/java/com/orientechnologies/orient/server/handler/AutomaticBackupTest.java @@ -33,7 +33,9 @@ import org.junit.BeforeClass; import org.junit.Test; -/** @author Luca Garulli (l.garulli--(at)--orientdb.com) */ +/** + * @author Luca Garulli (l.garulli--(at)--orientdb.com) + */ public class AutomaticBackupTest { private static final String DBNAME = "testautobackup"; private static final String DBNAME2 = DBNAME + "2"; @@ -47,10 +49,18 @@ public class AutomaticBackupTest { private final OServer server; public AutomaticBackupTest() - throws ClassNotFoundException, MalformedObjectNameException, InstanceAlreadyExistsException, - NotCompliantMBeanException, MBeanRegistrationException, IOException, - InstantiationException, IllegalAccessException, IllegalArgumentException, - SecurityException, InvocationTargetException, NoSuchMethodException { + throws ClassNotFoundException, + MalformedObjectNameException, + InstanceAlreadyExistsException, + NotCompliantMBeanException, + MBeanRegistrationException, + IOException, + InstantiationException, + IllegalAccessException, + IllegalArgumentException, + SecurityException, + InvocationTargetException, + NoSuchMethodException { // SET THE ORIENTDB_HOME DIRECTORY TO CHECK JSON FILE CREATION tempDirectory = new File("target/testhome").getAbsolutePath(); @@ -88,8 +98,12 @@ public static void afterClass() { @Before public void init() - throws InstantiationException, IllegalAccessException, ClassNotFoundException, - IllegalArgumentException, SecurityException, InvocationTargetException, + throws InstantiationException, + IllegalAccessException, + ClassNotFoundException, + IllegalArgumentException, + SecurityException, + InvocationTargetException, NoSuchMethodException { final File f = new File( @@ -239,8 +253,12 @@ public void testFullBackup() throws Exception { @Test public void testAutomaticBackupDisable() - throws IOException, ClassNotFoundException, MalformedObjectNameException, - InstanceAlreadyExistsException, NotCompliantMBeanException, MBeanRegistrationException { + throws IOException, + ClassNotFoundException, + MalformedObjectNameException, + InstanceAlreadyExistsException, + NotCompliantMBeanException, + MBeanRegistrationException { String jsonConfig = OIOUtils.readStreamAsString(getClass().getResourceAsStream("automatic-backup.json")); diff --git a/server/src/test/java/com/orientechnologies/orient/server/network/TestConcurrentCachedSequenceGenerationIT.java b/server/src/test/java/com/orientechnologies/orient/server/network/TestConcurrentCachedSequenceGenerationIT.java index 60bf96c3aef..b14cc4820eb 100755 --- a/server/src/test/java/com/orientechnologies/orient/server/network/TestConcurrentCachedSequenceGenerationIT.java +++ b/server/src/test/java/com/orientechnologies/orient/server/network/TestConcurrentCachedSequenceGenerationIT.java @@ -41,7 +41,8 @@ public void before() throws Exception { "sql", "CREATE CLASS TestSequence EXTENDS V;\n" + " CREATE SEQUENCE TestSequenceIdSequence TYPE CACHED CACHE 100;\n" - + "CREATE PROPERTY TestSequence.id LONG (MANDATORY TRUE, default \"sequence('TestSequenceIdSequence').next()\");\n" + + "CREATE PROPERTY TestSequence.id LONG (MANDATORY TRUE, default" + + " \"sequence('TestSequenceIdSequence').next()\");\n" + "CREATE INDEX TestSequence_id_index ON TestSequence (id BY VALUE) UNIQUE;"); databaseSession.close(); } diff --git a/server/src/test/java/com/orientechnologies/orient/server/network/TestConcurrentSequenceGenerationIT.java b/server/src/test/java/com/orientechnologies/orient/server/network/TestConcurrentSequenceGenerationIT.java index 3ccb50cf8bf..201ad486488 100755 --- a/server/src/test/java/com/orientechnologies/orient/server/network/TestConcurrentSequenceGenerationIT.java +++ b/server/src/test/java/com/orientechnologies/orient/server/network/TestConcurrentSequenceGenerationIT.java @@ -40,7 +40,8 @@ public void before() throws Exception { "sql", "CREATE CLASS TestSequence EXTENDS V;\n" + " CREATE SEQUENCE TestSequenceIdSequence TYPE ORDERED;\n" - + "CREATE PROPERTY TestSequence.id LONG (MANDATORY TRUE, default \"sequence('TestSequenceIdSequence').next()\");\n" + + "CREATE PROPERTY TestSequence.id LONG (MANDATORY TRUE, default" + + " \"sequence('TestSequenceIdSequence').next()\");\n" + "CREATE INDEX TestSequence_id_index ON TestSequence (id BY VALUE) UNIQUE;"); databaseSession.close(); } diff --git a/server/src/test/java/com/orientechnologies/orient/server/query/RemoteGraphTXTest.java b/server/src/test/java/com/orientechnologies/orient/server/query/RemoteGraphTXTest.java index c581e205827..02b4a4adc2f 100755 --- a/server/src/test/java/com/orientechnologies/orient/server/query/RemoteGraphTXTest.java +++ b/server/src/test/java/com/orientechnologies/orient/server/query/RemoteGraphTXTest.java @@ -26,7 +26,8 @@ public void itShouldDeleteEdgesInTx() { db.command("create vertex SecondV set id = '2'").close(); try (OResultSet resultSet = db.command( - "create edge TestEdge from ( select from FirstV where id = '1') to ( select from SecondV where id = '2')")) { + "create edge TestEdge from ( select from FirstV where id = '1') to ( select from" + + " SecondV where id = '2')")) { OResult result = resultSet.stream().iterator().next(); Assert.assertEquals(true, result.isEdge()); @@ -36,7 +37,8 @@ public void itShouldDeleteEdgesInTx() { db .command( - "delete edge TestEdge from (select from FirstV where id = :param1) to (select from SecondV where id = :param2)", + "delete edge TestEdge from (select from FirstV where id = :param1) to (select from" + + " SecondV where id = :param2)", new HashMap() { { put("param1", "1"); diff --git a/server/src/test/java/com/orientechnologies/orient/server/query/RemoteQuerySupportTest.java b/server/src/test/java/com/orientechnologies/orient/server/query/RemoteQuerySupportTest.java index 6c71977847e..e3df706c617 100755 --- a/server/src/test/java/com/orientechnologies/orient/server/query/RemoteQuerySupportTest.java +++ b/server/src/test/java/com/orientechnologies/orient/server/query/RemoteQuerySupportTest.java @@ -232,7 +232,8 @@ public void testScriptWithRidbags() { db.command("create vertex testScriptWithRidbagsV set name = 'b'"); db.command( - "create edge testScriptWithRidbagsE from (select from testScriptWithRidbagsV where name = 'a') TO (select from testScriptWithRidbagsV where name = 'b');"); + "create edge testScriptWithRidbagsE from (select from testScriptWithRidbagsV where name =" + + " 'a') TO (select from testScriptWithRidbagsV where name = 'b');"); String script = ""; script += "BEGIN;"; @@ -254,7 +255,8 @@ public void testLetOut() { db.command("create vertex letVertex set name = 'a'"); db.command("create vertex letVertex set name = 'b'"); db.command( - "create edge letEdge from (select from letVertex where name = 'a') TO (select from letVertex where name = 'b');"); + "create edge letEdge from (select from letVertex where name = 'a') TO (select from" + + " letVertex where name = 'b');"); OResultSet rs = db.query("select $someNode.in('letEdge') from letVertex LET $someNode =out('letEdge');"); diff --git a/server/src/test/java/com/orientechnologies/orient/server/security/ORemoteBasicSecurityTest.java b/server/src/test/java/com/orientechnologies/orient/server/security/ORemoteBasicSecurityTest.java index 6e248ecac74..63548abec49 100644 --- a/server/src/test/java/com/orientechnologies/orient/server/security/ORemoteBasicSecurityTest.java +++ b/server/src/test/java/com/orientechnologies/orient/server/security/ORemoteBasicSecurityTest.java @@ -25,16 +25,24 @@ public class ORemoteBasicSecurityTest { @Before public void before() - throws IOException, InstantiationException, InvocationTargetException, NoSuchMethodException, - MBeanRegistrationException, IllegalAccessException, InstanceAlreadyExistsException, - NotCompliantMBeanException, ClassNotFoundException, MalformedObjectNameException { + throws IOException, + InstantiationException, + InvocationTargetException, + NoSuchMethodException, + MBeanRegistrationException, + IllegalAccessException, + InstanceAlreadyExistsException, + NotCompliantMBeanException, + ClassNotFoundException, + MalformedObjectNameException { OGlobalConfiguration.SERVER_BACKWARD_COMPATIBILITY.setValue(false); server = OServer.startFromClasspathConfig("abstract-orientdb-server-config.xml"); OrientDB orientDB = new OrientDB("remote:localhost", "root", "root", OrientDBConfig.defaultConfig()); orientDB.execute( - "create database test memory users (admin identified by 'admin' role admin, reader identified by 'reader' role reader, writer identified by 'writer' role writer)"); + "create database test memory users (admin identified by 'admin' role admin, reader" + + " identified by 'reader' role reader, writer identified by 'writer' role writer)"); try (ODatabaseSession session = orientDB.open("test", "admin", "admin")) { session.createClass("one"); session.save(new ODocument("one")); diff --git a/server/src/test/java/com/orientechnologies/orient/server/security/ORemoteScriptSecurityTest.java b/server/src/test/java/com/orientechnologies/orient/server/security/ORemoteScriptSecurityTest.java index 214f8480c93..7d288fd74c5 100644 --- a/server/src/test/java/com/orientechnologies/orient/server/security/ORemoteScriptSecurityTest.java +++ b/server/src/test/java/com/orientechnologies/orient/server/security/ORemoteScriptSecurityTest.java @@ -23,16 +23,24 @@ public class ORemoteScriptSecurityTest { @Before public void before() - throws IOException, InstantiationException, InvocationTargetException, NoSuchMethodException, - MBeanRegistrationException, IllegalAccessException, InstanceAlreadyExistsException, - NotCompliantMBeanException, ClassNotFoundException, MalformedObjectNameException { + throws IOException, + InstantiationException, + InvocationTargetException, + NoSuchMethodException, + MBeanRegistrationException, + IllegalAccessException, + InstanceAlreadyExistsException, + NotCompliantMBeanException, + ClassNotFoundException, + MalformedObjectNameException { OGlobalConfiguration.SERVER_BACKWARD_COMPATIBILITY.setValue(false); server = OServer.startFromClasspathConfig("abstract-orientdb-server-config.xml"); OrientDB orientDB = new OrientDB("remote:localhost", "root", "root", OrientDBConfig.defaultConfig()); orientDB.execute( - "create database ORemoteScriptSecurityTest memory users (admin identified by 'admin' role admin)"); + "create database ORemoteScriptSecurityTest memory users (admin identified by 'admin' role" + + " admin)"); orientDB.close(); } diff --git a/server/src/test/java/com/orientechnologies/orient/server/security/ORemoteSecurityTests.java b/server/src/test/java/com/orientechnologies/orient/server/security/ORemoteSecurityTests.java index 27c296918b0..6ca0b9929fb 100644 --- a/server/src/test/java/com/orientechnologies/orient/server/security/ORemoteSecurityTests.java +++ b/server/src/test/java/com/orientechnologies/orient/server/security/ORemoteSecurityTests.java @@ -29,7 +29,8 @@ public void before() server = OServer.startFromClasspathConfig("abstract-orientdb-server-config.xml"); orient = new OrientDB("remote:localhost", "root", "root", OrientDBConfig.defaultConfig()); orient.execute( - "create database ? memory users (admin identified by 'admin' role admin, writer identified by 'writer' role writer, reader identified by 'reader' role reader)", + "create database ? memory users (admin identified by 'admin' role admin, writer identified" + + " by 'writer' role writer, reader identified by 'reader' role reader)", DB_NAME); this.db = orient.open(DB_NAME, "admin", "admin"); OClass person = db.createClass("Person"); diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/BaseHttpDatabaseTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/BaseHttpDatabaseTest.java index 105dddd6a2c..c81b31ad19d 100755 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/BaseHttpDatabaseTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/BaseHttpDatabaseTest.java @@ -29,8 +29,7 @@ public void createDatabase() throws Exception { .setUserName("root") .setUserPassword("root") .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); onAfterDatabaseCreated(); @@ -43,8 +42,7 @@ public void dropDatabase() throws Exception { .setUserName("root") .setUserPassword("root") .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 204); super.stopServer(); diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/BaseHttpTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/BaseHttpTest.java index 57b2bc65881..0e74fd78b0b 100755 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/BaseHttpTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/BaseHttpTest.java @@ -5,30 +5,24 @@ import com.orientechnologies.orient.server.OServer; import java.io.File; import java.io.IOException; -import org.apache.http.Consts; -import org.apache.http.Header; -import org.apache.http.HttpHost; -import org.apache.http.HttpResponse; -import org.apache.http.auth.AuthScope; -import org.apache.http.auth.UsernamePasswordCredentials; -import org.apache.http.client.AuthCache; -import org.apache.http.client.CredentialsProvider; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPatch; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.client.methods.HttpRequestBase; -import org.apache.http.client.protocol.HttpClientContext; -import org.apache.http.entity.AbstractHttpEntity; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.auth.BasicScheme; -import org.apache.http.impl.client.BasicAuthCache; -import org.apache.http.impl.client.BasicCredentialsProvider; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; +import org.apache.hc.client5.http.auth.AuthScope; +import org.apache.hc.client5.http.auth.UsernamePasswordCredentials; +import org.apache.hc.client5.http.classic.methods.HttpDelete; +import org.apache.hc.client5.http.classic.methods.HttpGet; +import org.apache.hc.client5.http.classic.methods.HttpPatch; +import org.apache.hc.client5.http.classic.methods.HttpPost; +import org.apache.hc.client5.http.classic.methods.HttpPut; +import org.apache.hc.client5.http.classic.methods.HttpUriRequestBase; +import org.apache.hc.client5.http.impl.auth.BasicCredentialsProvider; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; +import org.apache.hc.core5.http.ClassicHttpRequest; +import org.apache.hc.core5.http.ClassicHttpResponse; +import org.apache.hc.core5.http.ContentType; +import org.apache.hc.core5.http.Header; +import org.apache.hc.core5.http.HttpHost; +import org.apache.hc.core5.http.io.entity.AbstractHttpEntity; +import org.apache.hc.core5.http.io.entity.StringEntity; /** * Base test class for HTTP protocol. @@ -36,6 +30,7 @@ * @author Luca Garulli (l.garulli--(at)--orientdb.com) (l.garulli--at-orientdb.com) */ public abstract class BaseHttpTest { + protected String serverDirectory; private static OServer server; @@ -51,9 +46,11 @@ public abstract class BaseHttpTest { private String databaseName; private Boolean keepAlive = null; - private HttpRequestBase request; + private ClassicHttpRequest request; private AbstractHttpEntity payload; - private HttpResponse response; + private ClassicHttpResponse response; + + private CloseableHttpClient client; private int retry = 1; public enum CONTENT { @@ -65,8 +62,7 @@ public BaseHttpTest payload(final String content, final CONTENT contentType) { payload = new StringEntity( content, - ContentType.create( - contentType == CONTENT.JSON ? "application/json" : "plain/text", Consts.UTF_8)); + ContentType.create(contentType == CONTENT.JSON ? "application/json" : "plain/text")); return this; } @@ -82,6 +78,10 @@ protected void startServer() throws Exception { } protected void stopServer() throws Exception { + if (client != null) { + client.close(); + } + if (server != null) { server.shutdown(); server = null; @@ -100,35 +100,31 @@ protected boolean isInDevelopmentMode() { } protected BaseHttpTest exec() throws IOException { - final HttpHost targetHost = new HttpHost(getHost(), getPort(), getProtocol()); + final HttpHost targetHost = new HttpHost(getProtocol(), getHost(), getPort()); - CredentialsProvider credsProvider = new BasicCredentialsProvider(); + var credsProvider = new BasicCredentialsProvider(); credsProvider.setCredentials( new AuthScope(targetHost), - new UsernamePasswordCredentials(getUserName(), getUserPassword())); - - // Create AuthCache instance - AuthCache authCache = new BasicAuthCache(); - // Generate BASIC scheme object and add it to the local auth cache - BasicScheme basicAuth = new BasicScheme(); - authCache.put(targetHost, basicAuth); + new UsernamePasswordCredentials(getUserName(), getUserPassword().toCharArray())); - // Add AuthCache to the execution context - HttpClientContext context = HttpClientContext.create(); - context.setCredentialsProvider(credsProvider); - context.setAuthCache(authCache); + final BasicCredentialsProvider provider = new BasicCredentialsProvider(); + AuthScope authScope = new AuthScope(targetHost); + provider.setCredentials( + authScope, new UsernamePasswordCredentials(getUserName(), getUserPassword().toCharArray())); - if (keepAlive != null) request.addHeader("Connection", keepAlive ? "Keep-Alive" : "Close"); - - if (payload != null && request instanceof HttpEntityEnclosingRequestBase) - ((HttpEntityEnclosingRequestBase) request).setEntity(payload); + if (keepAlive != null) { + request.addHeader("Connection", keepAlive ? "Keep-Alive" : "Close"); + } - final CloseableHttpClient httpClient = HttpClients.createDefault(); + if (payload != null && request instanceof HttpUriRequestBase httpUriRequestBase) { + httpUriRequestBase.setEntity(payload); + } - // DefaultHttpMethodRetryHandler retryhandler = new DefaultHttpMethodRetryHandler(retry, false); + client = HttpClientBuilder.create().setDefaultCredentialsProvider(provider).build(); + // DefaultHttpMethodRetryHandler retryhandler = new DefaultHttpMethodRetryHandler(retry, + // false); // context.setAttribute(HttpMethodParams.RETRY_HANDLER, retryhandler); - - response = httpClient.execute(targetHost, request, context); + response = client.execute(request); return this; } @@ -171,8 +167,10 @@ protected BaseHttpTest patch(final String url) throws IOException { return this; } - protected HttpResponse getResponse() throws IOException { - if (response == null) exec(); + protected ClassicHttpResponse getResponse() throws IOException { + if (response == null) { + exec(); + } return response; } diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpAuthenticationTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpAuthenticationTest.java index 62b14a8fb3d..c9a8fabc55f 100755 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpAuthenticationTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpAuthenticationTest.java @@ -4,7 +4,9 @@ import java.net.URLEncoder; import org.junit.Assert; -/** @author Luca Garulli (l.garulli--(at)--orientdb.com) (l.garulli--at-orientdb.com) */ +/** + * @author Luca Garulli (l.garulli--(at)--orientdb.com) (l.garulli--at-orientdb.com) + */ public class HttpAuthenticationTest extends BaseHttpDatabaseTest { public void testChangeOfUserOnSameConnectionIsAllowed() throws IOException { Assert.assertEquals( @@ -16,8 +18,7 @@ public void testChangeOfUserOnSameConnectionIsAllowed() throws IOException { .setUserName("root") .setUserPassword("root") .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); Assert.assertEquals( @@ -29,8 +30,7 @@ public void testChangeOfUserOnSameConnectionIsAllowed() throws IOException { .setUserName("admin") .setUserPassword("admin") .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); } diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpBatchTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpBatchTest.java index 87ecaf6deee..b4e4d2bba57 100755 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpBatchTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpBatchTest.java @@ -7,8 +7,7 @@ import java.io.InputStreamReader; import java.util.Iterator; import java.util.List; -import org.apache.http.HttpResponse; -import org.apache.http.util.EntityUtils; +import org.apache.hc.core5.http.io.entity.EntityUtils; import org.junit.Assert; import org.junit.Before; @@ -24,13 +23,12 @@ public void beforeMethod() { getServer().getPlugin("script-interpreter").startup(); } - public void batchUpdate() throws IOException { + public void batchUpdate() throws Exception { Assert.assertEquals( post("command/" + getDatabaseName() + "/sql/") .payload("create class User", CONTENT.TEXT) .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); Assert.assertEquals( @@ -39,8 +37,7 @@ public void batchUpdate() throws IOException { .setUserName("admin") .setUserPassword("admin") .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); String response = EntityUtils.toString(getResponse().getEntity()); @@ -71,8 +68,7 @@ public void batchUpdate() throws IOException { + "}", CONTENT.JSON) .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); // TEST DOUBLE UPDATE @@ -96,8 +92,7 @@ public void batchUpdate() throws IOException { + "}", CONTENT.JSON) .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); // TEST WRONG VERSION ON UPDATE @@ -121,8 +116,7 @@ public void batchUpdate() throws IOException { + "}", CONTENT.JSON) .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 409); batchWithEmpty(); @@ -139,10 +133,9 @@ private void batchWithEmpty() throws IOException { + "return [$a, $b]\"" + "}]\n" + "}"; - HttpResponse response = - post("batch/" + getDatabaseName()).payload(json, CONTENT.TEXT).getResponse(); + var response = post("batch/" + getDatabaseName()).payload(json, CONTENT.TEXT).getResponse(); - Assert.assertEquals(response.getStatusLine().getStatusCode(), 200); + Assert.assertEquals(response.getCode(), 200); InputStream stream = response.getEntity().getContent(); String string = ""; BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpClassTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpClassTest.java index b6eac0909cb..447c3f8dae6 100755 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpClassTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpClassTest.java @@ -11,45 +11,27 @@ public class HttpClassTest extends BaseHttpDatabaseTest { @Test public void testExistentClass() throws Exception { - Assert.assertEquals( - get("class/" + getDatabaseName() + "/OUser").getResponse().getStatusLine().getStatusCode(), - 200); + Assert.assertEquals(get("class/" + getDatabaseName() + "/OUser").getResponse().getCode(), 200); } @Test public void testNonExistentClass() throws Exception { Assert.assertEquals( - get("class/" + getDatabaseName() + "/NonExistentCLass") - .getResponse() - .getStatusLine() - .getStatusCode(), - 404); + get("class/" + getDatabaseName() + "/NonExistentCLass").getResponse().getCode(), 404); } @Test public void testCreateClass() throws Exception { Assert.assertEquals( - post("class/" + getDatabaseName() + "/NewClass") - .getResponse() - .getStatusLine() - .getStatusCode(), - 201); + post("class/" + getDatabaseName() + "/NewClass").getResponse().getCode(), 201); } @Test public void testDropClass() throws Exception { Assert.assertEquals( - post("class/" + getDatabaseName() + "/NewClassToDrop") - .getResponse() - .getStatusLine() - .getStatusCode(), - 201); + post("class/" + getDatabaseName() + "/NewClassToDrop").getResponse().getCode(), 201); Assert.assertEquals( - delete("class/" + getDatabaseName() + "/NewClassToDrop") - .getResponse() - .getStatusLine() - .getStatusCode(), - 204); + delete("class/" + getDatabaseName() + "/NewClassToDrop").getResponse().getCode(), 204); } @Override diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpClusterTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpClusterTest.java index 739f2fc39a1..70365d687d2 100755 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpClusterTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpClusterTest.java @@ -12,21 +12,13 @@ public class HttpClusterTest extends BaseHttpDatabaseTest { @Test public void testExistentClass() throws Exception { Assert.assertEquals( - get("cluster/" + getDatabaseName() + "/OUser") - .getResponse() - .getStatusLine() - .getStatusCode(), - 200); + get("cluster/" + getDatabaseName() + "/OUser").getResponse().getCode(), 200); } @Test public void testNonExistentClass() throws Exception { Assert.assertEquals( - get("cluster/" + getDatabaseName() + "/NonExistentCLass") - .getResponse() - .getStatusLine() - .getStatusCode(), - 404); + get("cluster/" + getDatabaseName() + "/NonExistentCLass").getResponse().getCode(), 404); } @Override diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpCommandTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpCommandTest.java index 772db8f0f59..577df8781a4 100755 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpCommandTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpCommandTest.java @@ -20,8 +20,7 @@ public void commandRootCredentials() throws IOException { .setUserName("root") .setUserPassword("root") .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); } @@ -33,8 +32,7 @@ public void commandDatabaseCredentials() throws IOException { .setUserName("admin") .setUserPassword("admin") .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); } @@ -43,13 +41,13 @@ public void commandWithNamedParams() throws IOException { Assert.assertEquals( post("command/" + getDatabaseName() + "/sql/") .payload( - "{\"command\":\"select from OUSer where name = :name\",\"parameters\":{\"name\":\"admin\"}}", + "{\"command\":\"select from OUSer where name =" + + " :name\",\"parameters\":{\"name\":\"admin\"}}", CONTENT.TEXT) .setUserName("admin") .setUserPassword("admin") .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); final InputStream response = getResponse().getEntity().getContent(); @@ -72,8 +70,7 @@ public void commandWithPosParams() throws IOException { .setUserName("admin") .setUserPassword("admin") .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); final InputStream response = getResponse().getEntity().getContent(); diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpConnectionTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpConnectionTest.java index 209972c4b48..593b489ab54 100755 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpConnectionTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpConnectionTest.java @@ -15,8 +15,7 @@ public class HttpConnectionTest extends BaseHttpDatabaseTest { @Test public void testConnect() throws Exception { - Assert.assertEquals( - get("connect/" + getDatabaseName()).getResponse().getStatusLine().getStatusCode(), 204); + Assert.assertEquals(get("connect/" + getDatabaseName()).getResponse().getCode(), 204); } public void testTooManyConnect() throws Exception { @@ -37,11 +36,7 @@ public void testTooManyConnect() throws Exception { for (int i = 0; i < TOTAL; ++i) { try { final int response = - get("connect/" + getDatabaseName()) - .setRetry(0) - .getResponse() - .getStatusLine() - .getStatusCode(); + get("connect/" + getDatabaseName()).setRetry(0).getResponse().getCode(); Assert.assertEquals(response, 204); good++; } catch (IOException e) { @@ -79,12 +74,7 @@ protected void testConnectAutoDisconnect() throws Exception { int TOTAL = max * 3; for (int i = 0; i < TOTAL; ++i) { - final int response = - get("connect/" + getDatabaseName()) - .setRetry(0) - .getResponse() - .getStatusLine() - .getStatusCode(); + final int response = get("connect/" + getDatabaseName()).setRetry(0).getResponse().getCode(); Assert.assertEquals(response, 204); if (i % 100 == 0) System.out.printf("\nConnections " + i); @@ -100,8 +90,7 @@ protected void testConnectAutoDisconnect() throws Exception { .setUserName("root") .setUserPassword("root") .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); final ODocument serverStatus = diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpDatabaseTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpDatabaseTest.java index bcbb1b74f21..ebd83eb4b1c 100755 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpDatabaseTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpDatabaseTest.java @@ -2,11 +2,10 @@ import com.orientechnologies.orient.core.OConstants; import com.orientechnologies.orient.core.record.impl.ODocument; -import com.orientechnologies.orient.test.server.network.http.BaseHttpTest.CONTENT; import java.io.IOException; import java.net.URLEncoder; import java.util.Map; -import org.apache.http.HttpResponse; +import org.apache.hc.core5.http.HttpResponse; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -25,8 +24,7 @@ public void testCreateDatabaseNoType() throws Exception { .setUserPassword("root") .post("database/" + getDatabaseName()) .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 500); } @@ -37,8 +35,7 @@ public void testCreateDatabaseWrongPassword() throws Exception { .setUserPassword("wrongPasswod") .post("database/wrongpasswd") .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 401); } @@ -53,8 +50,7 @@ public void testCreateAndGetDatabase() throws IOException { .post("database/" + getDatabaseName() + "/memory") .payload(pass.toJSON(), CONTENT.JSON) .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); HttpResponse response = @@ -63,7 +59,7 @@ public void testCreateAndGetDatabase() throws IOException { .get("database/" + getDatabaseName()) .getResponse(); - Assert.assertEquals(200, response.getStatusLine().getStatusCode()); + Assert.assertEquals(200, response.getCode()); final ODocument payload = new ODocument().fromJSON(getResponse().getEntity().getContent()); @@ -81,8 +77,7 @@ public void testCreateQueryAndDropDatabase() throws Exception { .post("database/" + getDatabaseName() + "/memory") .payload(pass.toJSON(), CONTENT.JSON) .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); Assert.assertEquals( @@ -95,8 +90,7 @@ public void testCreateQueryAndDropDatabase() throws Exception { + URLEncoder.encode("select from OUSer", "UTF8") + "/10") .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); Assert.assertEquals( @@ -104,8 +98,7 @@ public void testCreateQueryAndDropDatabase() throws Exception { .setUserPassword("root") .delete("database/" + getDatabaseName()) .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 204); } @@ -116,8 +109,7 @@ public void testDropUnknownDatabase() throws Exception { .setUserPassword("root") .delete("database/whateverdbname") .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 500); } diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpDisabledTokenTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpDisabledTokenTest.java index 0f5d979fe08..7c0ed03d386 100644 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpDisabledTokenTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpDisabledTokenTest.java @@ -5,20 +5,21 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; -import org.apache.http.HttpEntity; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; +import org.apache.hc.client5.http.ClientProtocolException; +import org.apache.hc.client5.http.classic.methods.HttpPost; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.core5.http.HttpEntity; +import org.apache.hc.core5.http.io.entity.StringEntity; import org.junit.Test; public class HttpDisabledTokenTest extends BaseHttpDatabaseTest { protected String getServerCfg() { return "/com/orientechnologies/orient/server/network/orientdb-server-config-httponly-notoken.xml"; - }; + } + ; @Test public void testTokenRequest() throws ClientProtocolException, IOException { @@ -26,7 +27,7 @@ public void testTokenRequest() throws ClientProtocolException, IOException { request.setEntity(new StringEntity("grant_type=password&username=admin&password=admin")); final CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse response = httpClient.execute(request); - assertEquals(response.getStatusLine().getStatusCode(), 400); + assertEquals(response.getCode(), 400); HttpEntity entity = response.getEntity(); ByteArrayOutputStream out = new ByteArrayOutputStream(); entity.writeTo(out); diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpDocumentTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpDocumentTest.java index 126e696c982..912929122c2 100755 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpDocumentTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpDocumentTest.java @@ -18,7 +18,7 @@ public void create() throws IOException { .payload("{@class:'V', name:'Jay', surname:'Miner',age:99, \"@version\":100}", CONTENT.JSON) .exec(); - Assert.assertEquals(201, getResponse().getStatusLine().getStatusCode()); + Assert.assertEquals(201, getResponse().getCode()); final ODocument created = new ODocument().fromJSON(getResponse().getEntity().getContent()); @@ -34,7 +34,7 @@ public void read() throws IOException { post("document/" + getDatabaseName()) .payload("{@class:'V', name:'Jay', surname:'Miner',age:99}", CONTENT.JSON) .exec(); - Assert.assertEquals(getResponse().getStatusLine().getStatusCode(), 201); + Assert.assertEquals(getResponse().getCode(), 201); final ODocument created = new ODocument().fromJSON(getResponse().getEntity().getContent()); Assert.assertEquals(created.field("name"), "Jay"); @@ -44,7 +44,7 @@ public void read() throws IOException { get("document/" + getDatabaseName() + "/" + created.getIdentity().toString().substring(1)) .exec(); - Assert.assertEquals(getResponse().getStatusLine().getStatusCode(), 200); + Assert.assertEquals(getResponse().getCode(), 200); final ODocument updated = new ODocument().fromJSON(getResponse().getEntity().getContent()); Assert.assertEquals(updated.field("name"), "Jay"); @@ -58,7 +58,7 @@ public void updateFull() throws IOException { post("document/" + getDatabaseName()) .payload("{@class:'V', name:'Jay', surname:'Miner',age:0}", CONTENT.JSON) .exec(); - Assert.assertEquals(getResponse().getStatusLine().getStatusCode(), 201); + Assert.assertEquals(getResponse().getCode(), 201); final ODocument created = new ODocument().fromJSON(getResponse().getEntity().getContent()); Assert.assertEquals(created.field("name"), "Jay"); @@ -73,7 +73,7 @@ public void updateFull() throws IOException { put("document/" + getDatabaseName() + "/" + created.getIdentity().toString().substring(1)) .payload(created.toJSON(), CONTENT.JSON) .exec(); - Assert.assertEquals(getResponse().getStatusLine().getStatusCode(), 200); + Assert.assertEquals(getResponse().getCode(), 200); final ODocument updated = new ODocument().fromJSON(getResponse().getEntity().getContent()); Assert.assertEquals(updated.field("name"), "Jay2"); @@ -87,7 +87,7 @@ public void updateFullNoVersion() throws IOException { post("document/" + getDatabaseName()) .payload("{@class:'V', name:'Jay', surname:'Miner',age:0}", CONTENT.JSON) .exec(); - Assert.assertEquals(getResponse().getStatusLine().getStatusCode(), 201); + Assert.assertEquals(getResponse().getCode(), 201); final ODocument created = new ODocument().fromJSON(getResponse().getEntity().getContent()); Assert.assertEquals(created.field("name"), "Jay"); @@ -98,7 +98,7 @@ public void updateFullNoVersion() throws IOException { put("document/" + getDatabaseName() + "/" + created.getIdentity().toString().substring(1)) .payload("{name:'Jay2', surname:'Miner2',age:1}", CONTENT.JSON) .exec(); - Assert.assertEquals(getResponse().getStatusLine().getStatusCode(), 200); + Assert.assertEquals(getResponse().getCode(), 200); final ODocument updated = new ODocument().fromJSON(getResponse().getEntity().getContent()); Assert.assertEquals(updated.field("name"), "Jay2"); @@ -112,7 +112,7 @@ public void updateFullBadVersion() throws IOException { post("document/" + getDatabaseName()) .payload("{@class:'V', name:'Jay', surname:'Miner',age:0}", CONTENT.JSON) .exec(); - Assert.assertEquals(getResponse().getStatusLine().getStatusCode(), 201); + Assert.assertEquals(getResponse().getCode(), 201); final ODocument created = new ODocument().fromJSON(getResponse().getEntity().getContent()); Assert.assertEquals(created.field("name"), "Jay"); @@ -123,7 +123,7 @@ public void updateFullBadVersion() throws IOException { put("document/" + getDatabaseName() + "/" + created.getIdentity().toString().substring(1)) .payload("{name:'Jay2', surname:'Miner2',age:1, @version: 2}", CONTENT.JSON) .exec(); - Assert.assertEquals(getResponse().getStatusLine().getStatusCode(), 409); + Assert.assertEquals(getResponse().getCode(), 409); } @Test @@ -131,7 +131,7 @@ public void updatePartial() throws IOException { post("document/" + getDatabaseName()) .payload("{@class:'V', name:'Jay', surname:'Miner',age:0}", CONTENT.JSON) .exec(); - Assert.assertEquals(getResponse().getStatusLine().getStatusCode(), 201); + Assert.assertEquals(getResponse().getCode(), 201); final ODocument created = new ODocument().fromJSON(getResponse().getEntity().getContent()); Assert.assertEquals(created.field("name"), "Jay"); @@ -146,7 +146,7 @@ public void updatePartial() throws IOException { + "?updateMode=partial") .payload("{age:1}", CONTENT.JSON) .exec(); - Assert.assertEquals(getResponse().getStatusLine().getStatusCode(), 200); + Assert.assertEquals(getResponse().getCode(), 200); final ODocument updated = new ODocument().fromJSON(getResponse().getEntity().getContent()); Assert.assertEquals(updated.field("name"), "Jay"); @@ -160,7 +160,7 @@ public void patchPartial() throws IOException { post("document/" + getDatabaseName()) .payload("{@class:'V', name:'Jay', surname:'Miner',age:0}", CONTENT.JSON) .exec(); - Assert.assertEquals(getResponse().getStatusLine().getStatusCode(), 201); + Assert.assertEquals(getResponse().getCode(), 201); final ODocument created = new ODocument().fromJSON(getResponse().getEntity().getContent()); Assert.assertEquals(created.field("name"), "Jay"); @@ -171,7 +171,7 @@ public void patchPartial() throws IOException { patch("document/" + getDatabaseName() + "/" + created.getIdentity().toString().substring(1)) .payload("{age:1,@version:1}", CONTENT.JSON) .exec(); - Assert.assertEquals(getResponse().getStatusLine().getStatusCode(), 200); + Assert.assertEquals(getResponse().getCode(), 200); final ODocument updated = new ODocument().fromJSON(getResponse().getEntity().getContent()); Assert.assertEquals(updated.field("name"), "Jay"); @@ -185,7 +185,7 @@ public void deleteByRid() throws IOException { post("document/" + getDatabaseName()) .payload("{@class:'V', name:'Jay', surname:'Miner',age:0}", CONTENT.JSON) .exec(); - Assert.assertEquals(getResponse().getStatusLine().getStatusCode(), 201); + Assert.assertEquals(getResponse().getCode(), 201); final ODocument created = new ODocument().fromJSON(getResponse().getEntity().getContent()); Assert.assertEquals(created.field("name"), "Jay"); @@ -195,11 +195,11 @@ public void deleteByRid() throws IOException { delete("document/" + getDatabaseName() + "/" + created.getIdentity().toString().substring(1)) .exec(); - Assert.assertEquals(getResponse().getStatusLine().getStatusCode(), 204); + Assert.assertEquals(getResponse().getCode(), 204); get("document/" + getDatabaseName() + "/" + created.getIdentity().toString().substring(1)) .exec(); - Assert.assertEquals(getResponse().getStatusLine().getStatusCode(), 404); + Assert.assertEquals(getResponse().getCode(), 404); } @Test @@ -207,7 +207,7 @@ public void deleteWithMVCC() throws IOException { post("document/" + getDatabaseName()) .payload("{@class:'V', name:'Jay', surname:'Miner',age:0}", CONTENT.JSON) .exec(); - Assert.assertEquals(getResponse().getStatusLine().getStatusCode(), 201); + Assert.assertEquals(getResponse().getCode(), 201); final ODocument created = new ODocument().fromJSON(getResponse().getEntity().getContent()); Assert.assertEquals(created.field("name"), "Jay"); @@ -218,11 +218,11 @@ public void deleteWithMVCC() throws IOException { delete("document/" + getDatabaseName() + "/" + created.getIdentity().toString().substring(1)) .payload(created.toJSON(), CONTENT.JSON) .exec(); - Assert.assertEquals(getResponse().getStatusLine().getStatusCode(), 204); + Assert.assertEquals(getResponse().getCode(), 204); get("document/" + getDatabaseName() + "/" + created.getIdentity().toString().substring(1)) .exec(); - Assert.assertEquals(getResponse().getStatusLine().getStatusCode(), 404); + Assert.assertEquals(getResponse().getCode(), 404); } @Override diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpErrorsTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpErrorsTest.java index 877c15228f9..1a1504aa56a 100755 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpErrorsTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpErrorsTest.java @@ -14,24 +14,14 @@ public class HttpErrorsTest extends BaseHttpTest { @Test public void testCommandNotFound() throws Exception { Assert.assertEquals( - setUserName("root") - .setUserPassword("root") - .get("commandNotfound") - .getResponse() - .getStatusLine() - .getStatusCode(), + setUserName("root").setUserPassword("root").get("commandNotfound").getResponse().getCode(), 405); } @Test public void testCommandWrongMethod() throws Exception { Assert.assertEquals( - setUserName("root") - .setUserPassword("root") - .post("listDatabases") - .getResponse() - .getStatusLine() - .getStatusCode(), + setUserName("root").setUserPassword("root").post("listDatabases").getResponse().getCode(), 405); } diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpFunctionTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpFunctionTest.java index 6f18632c926..e8e60a3af35 100755 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpFunctionTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpFunctionTest.java @@ -1,9 +1,8 @@ package com.orientechnologies.orient.test.server.network.http; import com.orientechnologies.orient.core.record.impl.ODocument; -import java.io.IOException; import java.util.List; -import org.apache.http.util.EntityUtils; +import org.apache.hc.core5.http.io.entity.EntityUtils; import org.junit.Assert; import org.junit.Test; @@ -15,16 +14,16 @@ public class HttpFunctionTest extends BaseHttpDatabaseTest { @Test - public void callFunction() throws IOException { + public void callFunction() throws Exception { // CREATE FUNCTION FIRST Assert.assertEquals( post("command/" + getDatabaseName() + "/sql/") .payload( - "CREATE FUNCTION hello \"return 'Hello ' + name + ' ' + surname;\" PARAMETERS [name,surname] LANGUAGE javascript", + "CREATE FUNCTION hello \"return 'Hello ' + name + ' ' + surname;\" PARAMETERS" + + " [name,surname] LANGUAGE javascript", CONTENT.TEXT) .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); Assert.assertEquals( @@ -33,8 +32,7 @@ public void callFunction() throws IOException { .setUserName("admin") .setUserPassword("admin") .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); String response = EntityUtils.toString(getResponse().getEntity()); diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpGephiTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpGephiTest.java index b5f4a23fbc2..24567774e89 100755 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpGephiTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpGephiTest.java @@ -1,7 +1,7 @@ package com.orientechnologies.orient.test.server.network.http; import java.io.IOException; -import org.apache.http.HttpResponse; +import org.apache.hc.core5.http.HttpResponse; import org.junit.Assert; import org.junit.Test; @@ -20,12 +20,12 @@ public void commandRootCredentials() throws IOException { .setUserPassword("root") .getResponse(); - Assert.assertEquals(200, response.getStatusLine().getStatusCode()); + Assert.assertEquals(200, response.getCode()); } @Test public void commandDatabaseCredentials() throws IOException { - HttpResponse response = + var response = get("gephi/" + getDatabaseName() + "/sql/select%20from%20V") .setUserName("admin") .setUserPassword("admin") @@ -33,7 +33,7 @@ public void commandDatabaseCredentials() throws IOException { response.getEntity().writeTo(System.out); - Assert.assertEquals(200, response.getStatusLine().getStatusCode()); + Assert.assertEquals(200, response.getCode()); } @Override @@ -48,8 +48,7 @@ public void createDatabase() throws Exception { .setUserName("admin") .setUserPassword("admin") .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); Assert.assertEquals( @@ -60,20 +59,19 @@ public void createDatabase() throws Exception { .setUserName("admin") .setUserPassword("admin") .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); Assert.assertEquals( post("command/" + getDatabaseName() + "/sql/") .payload( - "{\"command\":\"create edge from (select from v where name = 'Jay') to (select from v where name = 'Amiga')\"}", + "{\"command\":\"create edge from (select from v where name = 'Jay') to (select from" + + " v where name = 'Amiga')\"}", CONTENT.TEXT) .setUserName("admin") .setUserPassword("admin") .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); } diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpGetStaticContentTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpGetStaticContentTest.java index 0e79c00c538..9641e58e6ff 100755 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpGetStaticContentTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpGetStaticContentTest.java @@ -7,7 +7,6 @@ import com.orientechnologies.orient.server.network.protocol.http.command.get.OServerCommandGetStaticContent; import java.io.BufferedInputStream; import java.net.URL; -import org.apache.http.HttpResponse; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -54,8 +53,8 @@ public Object call(final String iArgument) { @Test public void testIndexHTML() throws Exception { - HttpResponse response = get("fake/index.htm").getResponse(); - Assert.assertEquals(200, response.getStatusLine().getStatusCode()); + var response = get("fake/index.htm").getResponse(); + Assert.assertEquals(200, response.getCode()); String expected = OIOUtils.readStreamAsString( diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpGraphTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpGraphTest.java index 029e25c5b04..6db7407c4c7 100755 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpGraphTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpGraphTest.java @@ -6,7 +6,6 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import org.apache.http.HttpResponse; import org.junit.Assert; import org.junit.Test; @@ -23,15 +22,13 @@ public void updateWithEdges() throws IOException { post("command/" + getDatabaseName() + "/sql/") .payload("create class Foo extends V", CONTENT.TEXT) .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); Assert.assertEquals( post("command/" + getDatabaseName() + "/sql/") .payload("create class FooEdge extends E", CONTENT.TEXT) .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); String script = "begin;"; @@ -42,13 +39,14 @@ public void updateWithEdges() throws IOException { script += "return $v1;"; final String scriptPayload = - "{ \"operations\" : [{ \"type\" : \"script\", \"language\" : \"SQL\", \"script\" : \"%s\"}]}"; + "{ \"operations\" : [{ \"type\" : \"script\", \"language\" : \"SQL\", \"script\" :" + + " \"%s\"}]}"; - HttpResponse response = + var response = post("batch/" + getDatabaseName() + "/sql/") .payload(String.format(scriptPayload, script), CONTENT.JSON) .getResponse(); - Assert.assertEquals(response.getStatusLine().getStatusCode(), 200); + Assert.assertEquals(response.getCode(), 200); final ODocument result = new ODocument().fromJSON(response.getEntity().getContent()); @@ -67,7 +65,7 @@ public void updateWithEdges() throws IOException { .payload(created.toJSON(), CONTENT.JSON) .exec() .getResponse(); - Assert.assertEquals(response.getStatusLine().getStatusCode(), 200); + Assert.assertEquals(response.getCode(), 200); final ODocument updated = new ODocument().fromJSON(response.getEntity().getContent()); Assert.assertEquals(updated.field("name"), "fooUpdated"); @@ -82,15 +80,13 @@ public void getGraphResult() throws IOException { post("command/" + getDatabaseName() + "/sql/") .payload("create class Foo extends V", CONTENT.TEXT) .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); Assert.assertEquals( post("command/" + getDatabaseName() + "/sql/") .payload("create class FooEdge extends E", CONTENT.TEXT) .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); String script = "begin;"; @@ -101,13 +97,14 @@ public void getGraphResult() throws IOException { script += "return $v1;"; final String scriptPayload = - "{ \"operations\" : [{ \"type\" : \"script\", \"language\" : \"SQL\", \"script\" : \"%s\"}]}"; + "{ \"operations\" : [{ \"type\" : \"script\", \"language\" : \"SQL\", \"script\" :" + + " \"%s\"}]}"; - HttpResponse response = + var response = post("batch/" + getDatabaseName() + "/sql/") .payload(String.format(scriptPayload, script), CONTENT.JSON) .getResponse(); - Assert.assertEquals(response.getStatusLine().getStatusCode(), 200); + Assert.assertEquals(response.getCode(), 200); final String payload = new ODocument().field("command", "select from E").field("mode", "graph").toJSON(); diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpImportTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpImportTest.java index 457f26b7cdc..13d6f4f7fac 100644 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpImportTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpImportTest.java @@ -8,7 +8,6 @@ import java.io.InputStreamReader; import java.util.LinkedList; import java.util.List; -import org.apache.http.HttpResponse; import org.junit.Test; /** Created by tglman on 16/03/16. */ @@ -20,8 +19,8 @@ public void testImport() throws IOException { String content = "{\"records\": [{\"@type\": \"d\", \"@rid\": \"#9:0\",\"@version\": 1,\"@class\": \"V\"}]}"; post("import/" + getDatabaseName() + "?merge=true").payload(content, CONTENT.TEXT); - HttpResponse response = getResponse(); - assertEquals(200, response.getStatusLine().getStatusCode()); + var response = getResponse(); + assertEquals(200, response.getCode()); InputStream is = response.getEntity().getContent(); List out = new LinkedList<>(); diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpListDatabasesTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpListDatabasesTest.java index 463944a94e6..c07be0f6f41 100755 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpListDatabasesTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpListDatabasesTest.java @@ -14,24 +14,14 @@ public class HttpListDatabasesTest extends BaseHttpTest { @Test public void testListDatabasesRootUser() throws Exception { Assert.assertEquals( - setUserName("root") - .setUserPassword("root") - .get("listDatabases") - .getResponse() - .getStatusLine() - .getStatusCode(), + setUserName("root").setUserPassword("root").get("listDatabases").getResponse().getCode(), 200); } @Test public void testListDatabasesGuestUser() throws Exception { Assert.assertEquals( - setUserName("guest") - .setUserPassword("guest") - .get("listDatabases") - .getResponse() - .getStatusLine() - .getStatusCode(), + setUserName("guest").setUserPassword("guest").get("listDatabases").getResponse().getCode(), 200); } diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpQueryTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpQueryTest.java index dace0d2399d..dd32057c216 100755 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpQueryTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpQueryTest.java @@ -22,8 +22,7 @@ public void queryRootCredentials() throws IOException { .setUserName("root") .setUserPassword("root") .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); } @@ -38,8 +37,7 @@ public void queryDatabaseCredentials() throws IOException { .setUserName("admin") .setUserPassword("admin") .getResponse() - .getStatusLine() - .getStatusCode(), + .getCode(), 200); } diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpServerTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpServerTest.java index 6e94a4ab47d..ff5cc0e3161 100755 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpServerTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpServerTest.java @@ -2,15 +2,14 @@ import com.orientechnologies.orient.core.record.impl.ODocument; import java.io.IOException; -import org.apache.http.HttpResponse; import org.junit.Assert; import org.junit.Test; public class HttpServerTest extends BaseHttpDatabaseTest { @Test public void testGetServer() throws Exception { - HttpResponse res = get("server").getResponse(); - Assert.assertEquals(res.getStatusLine().getStatusCode(), 200); + var res = get("server").getResponse(); + Assert.assertEquals(res.getCode(), 200); ODocument payload = new ODocument().fromJSON(res.getEntity().getContent()); @@ -19,9 +18,8 @@ public void testGetServer() throws Exception { @Test public void testGetConnections() throws Exception { - HttpResponse res = - setUserName("root").setUserPassword("root").get("connections/").getResponse(); - Assert.assertEquals(res.getStatusLine().getStatusCode(), 200); + var res = setUserName("root").setUserPassword("root").get("connections/").getResponse(); + Assert.assertEquals(res.getCode(), 200); ODocument payload = new ODocument().fromJSON(res.getEntity().getContent()); @@ -31,14 +29,14 @@ public void testGetConnections() throws Exception { @Test public void testCreateDatabase() throws IOException { String dbName = getClass().getSimpleName() + "testCreateDatabase"; - HttpResponse res = + var res = setUserName("root") .setUserPassword("root") .post("servercommand") .payload("{\"command\":\"create database " + dbName + " plocal\" }", CONTENT.JSON) .getResponse(); - System.out.println(res.getStatusLine().getReasonPhrase()); - Assert.assertEquals(res.getStatusLine().getStatusCode(), 200); + System.out.println(res.getCode()); + Assert.assertEquals(res.getCode(), 200); Assert.assertTrue(getServer().getContext().exists(dbName)); getServer().getContext().drop(dbName); diff --git a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpXRequestedWithXMLHttpRequestTest.java b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpXRequestedWithXMLHttpRequestTest.java index 5403bb9b9ec..de990f43aaf 100644 --- a/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpXRequestedWithXMLHttpRequestTest.java +++ b/server/src/test/java/com/orientechnologies/orient/test/server/network/http/HttpXRequestedWithXMLHttpRequestTest.java @@ -1,13 +1,14 @@ package com.orientechnologies.orient.test.server.network.http; import java.io.IOException; -import org.apache.http.Header; -import org.apache.http.HttpResponse; -import org.apache.http.message.BasicHeader; +import org.apache.hc.core5.http.Header; +import org.apache.hc.core5.http.message.BasicHeader; import org.junit.Assert; import org.junit.Test; -/** @author Enrico Risa */ +/** + * @author Enrico Risa + */ public class HttpXRequestedWithXMLHttpRequestTest extends BaseHttpDatabaseTest { protected void onAfterDatabaseCreated() throws Exception { setUserPassword("123456"); @@ -17,17 +18,17 @@ protected void onAfterDatabaseCreated() throws Exception { public void sendXMLHttpRequest() throws IOException { Header[] headers = {new BasicHeader("X-Requested-With", "XMLHttpRequest")}; - HttpResponse response = get("class/" + getDatabaseName() + "/OUser", headers).getResponse(); + var response = get("class/" + getDatabaseName() + "/OUser", headers).getResponse(); - Assert.assertEquals(response.getStatusLine().getStatusCode(), 401); + Assert.assertEquals(response.getCode(), 401); Assert.assertEquals(response.containsHeader("WWW-Authenticate"), false); } @Test public void sendHttpRequest() throws IOException { - HttpResponse response = get("class/" + getDatabaseName() + "/OUser").getResponse(); + var response = get("class/" + getDatabaseName() + "/OUser").getResponse(); - Assert.assertEquals(response.getStatusLine().getStatusCode(), 401); + Assert.assertEquals(response.getCode(), 401); Assert.assertEquals(response.containsHeader("WWW-Authenticate"), true); } diff --git a/test-commons/pom.xml b/test-commons/pom.xml index 31f9832993b..92e704990cd 100755 --- a/test-commons/pom.xml +++ b/test-commons/pom.xml @@ -18,6 +18,8 @@ -Dmemory.directMemory.preallocate=false ${project.basedir}/../ + + 2023-01-01T00:00:00Z diff --git a/test-commons/src/main/java/com/orientechnologies/orient/test/CompositeException.java b/test-commons/src/main/java/com/orientechnologies/orient/test/CompositeException.java index 08205f855cc..fa850b4cc8a 100755 --- a/test-commons/src/main/java/com/orientechnologies/orient/test/CompositeException.java +++ b/test-commons/src/main/java/com/orientechnologies/orient/test/CompositeException.java @@ -21,7 +21,9 @@ import java.util.Collection; import java.util.List; -/** @author richter */ +/** + * @author richter + */ public class CompositeException extends RuntimeException { private static final long serialVersionUID = 1L; private final List causes = new ArrayList(); diff --git a/tests/pom.xml b/tests/pom.xml index eba98d28244..9da44692e0a 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -26,6 +26,8 @@ UTF-8 + + 2023-01-01T00:00:00Z diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/BetweenConversionTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/BetweenConversionTest.java index 9b9d4effc41..716a7d82e05 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/BetweenConversionTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/BetweenConversionTest.java @@ -325,7 +325,8 @@ public void testBetweenIndex() { public void testBetweenRightLeftIncludedDeepQuery() { final String query = - "select from BetweenConversionTest where (vl = 'v1' and (vl <> 'v3' and (vl <> 'v2' and ((a >= 1 and a <= 7) and vl = 'v1'))) and vl <> 'v4')"; + "select from BetweenConversionTest where (vl = 'v1' and (vl <> 'v3' and (vl <> 'v2' and ((a" + + " >= 1 and a <= 7) and vl = 'v1'))) and vl <> 'v4')"; final List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 4); @@ -344,7 +345,8 @@ public void testBetweenRightLeftIncludedDeepQuery() { public void testBetweenRightLeftIncludedDeepQueryIndex() { final String query = - "select from BetweenConversionTest where (vl = 'v1' and (vl <> 'v3' and (vl <> 'v2' and ((ai >= 1 and ai <= 7) and vl = 'v1'))) and vl <> 'v4')"; + "select from BetweenConversionTest where (vl = 'v1' and (vl <> 'v3' and (vl <> 'v2' and" + + " ((ai >= 1 and ai <= 7) and vl = 'v1'))) and vl <> 'v4')"; final List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 4); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CRUDDocumentPhysicalTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CRUDDocumentPhysicalTest.java index 6d21e381084..0941c1ab701 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CRUDDocumentPhysicalTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CRUDDocumentPhysicalTest.java @@ -355,7 +355,8 @@ public void testDbCacheUpdated() { database .command( new OSQLSynchQuery( - "select from Profile where tag_list contains 'actor' and tag_list contains 'test'")) + "select from Profile where tag_list contains 'actor' and tag_list contains" + + " 'test'")) .execute(); Assert.assertEquals(result.size(), 1); } diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CRUDDocumentValidationTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CRUDDocumentValidationTest.java index 7794e8feca7..3761828e03c 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CRUDDocumentValidationTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CRUDDocumentValidationTest.java @@ -78,7 +78,8 @@ public void validationMaxString() { record.field("id", 23723); record.field( "text", - "clfdkkjsd hfsdkjhf fjdkghjkfdhgjdfh gfdgjfdkhgfd skdjaksdjf skdjf sdkjfsd jfkldjfkjsdf kljdk fsdjf kldjgjdhjg khfdjgk hfjdg hjdfhgjkfhdgj kfhdjghrjg"); + "clfdkkjsd hfsdkjhf fjdkghjkfdhgjdfh gfdgjfdkhgfd skdjaksdjf skdjf sdkjfsd jfkldjfkjsdf" + + " kljdk fsdjf kldjgjdhjg khfdjgk hfjdg hjdfhgjkfhdgj kfhdjghrjg"); record.save(); } @@ -135,7 +136,8 @@ public void createSchemaForMandatoryNullableTest() throws ParseException { database.command("ALTER PROPERTY MyTestClass.stringField NOTNULL false").close(); database .command( - "INSERT INTO MyTestClass (keyField,dateTimeField,stringField) VALUES (\"K1\",null,null)") + "INSERT INTO MyTestClass (keyField,dateTimeField,stringField) VALUES" + + " (\"K1\",null,null)") .close(); database.reload(); database.getMetadata().reload(); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CRUDObjectPhysicalTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CRUDObjectPhysicalTest.java index 5724c111706..d56f99aba81 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CRUDObjectPhysicalTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CRUDObjectPhysicalTest.java @@ -2114,7 +2114,8 @@ public void oidentifableFieldsTest() { .getBytes(), out.toByteArray()); Assert.assertEquals( - "this is a bytearray test. if you read this Object database has stored it correctlyVERSION2", + "this is a bytearray test. if you read this Object database has stored it" + + " correctlyVERSION2", new String(out.toByteArray())); } finally { out.close(); @@ -2140,7 +2141,8 @@ public void oidentifableFieldsTest() { .getBytes(), out.toByteArray()); Assert.assertEquals( - "this is a bytearray test. if you read this Object database has stored it correctlyVERSION2", + "this is a bytearray test. if you read this Object database has stored it" + + " correctlyVERSION2", new String(out.toByteArray())); } finally { out.close(); @@ -2170,7 +2172,8 @@ public void oidentifableFieldsTest() { .getBytes(), out.toByteArray()); Assert.assertEquals( - "this is a bytearray test. if you read this Object database has stored it correctlyVERSION2", + "this is a bytearray test. if you read this Object database has stored it" + + " correctlyVERSION2", new String(out.toByteArray())); } finally { out.close(); @@ -2196,7 +2199,8 @@ public void oidentifableFieldsTest() { .getBytes(), out.toByteArray()); Assert.assertEquals( - "this is a bytearray test. if you read this Object database has stored it correctlyVERSION2", + "this is a bytearray test. if you read this Object database has stored it" + + " correctlyVERSION2", new String(out.toByteArray())); } finally { out.close(); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CRUDObjectPhysicalTestSchemaFull.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CRUDObjectPhysicalTestSchemaFull.java index 738705e7db1..d960021c57b 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CRUDObjectPhysicalTestSchemaFull.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CRUDObjectPhysicalTestSchemaFull.java @@ -2107,7 +2107,8 @@ public void oidentifableFieldsTest() { .getBytes(), out.toByteArray()); Assert.assertEquals( - "this is a bytearray test. if you read this Object database has stored it correctlyVERSION2", + "this is a bytearray test. if you read this Object database has stored it" + + " correctlyVERSION2", new String(out.toByteArray())); } finally { out.close(); @@ -2133,7 +2134,8 @@ public void oidentifableFieldsTest() { .getBytes(), out.toByteArray()); Assert.assertEquals( - "this is a bytearray test. if you read this Object database has stored it correctlyVERSION2", + "this is a bytearray test. if you read this Object database has stored it" + + " correctlyVERSION2", new String(out.toByteArray())); } finally { out.close(); @@ -2163,7 +2165,8 @@ public void oidentifableFieldsTest() { .getBytes(), out.toByteArray()); Assert.assertEquals( - "this is a bytearray test. if you read this Object database has stored it correctlyVERSION2", + "this is a bytearray test. if you read this Object database has stored it" + + " correctlyVERSION2", new String(out.toByteArray())); } finally { out.close(); @@ -2189,7 +2192,8 @@ public void oidentifableFieldsTest() { .getBytes(), out.toByteArray()); Assert.assertEquals( - "this is a bytearray test. if you read this Object database has stored it correctlyVERSION2", + "this is a bytearray test. if you read this Object database has stored it" + + " correctlyVERSION2", new String(out.toByteArray())); } finally { out.close(); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/ClassIndexTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/ClassIndexTest.java index 510cbf23bec..dd7767ab6fe 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/ClassIndexTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/ClassIndexTest.java @@ -666,7 +666,8 @@ public void testCreateOnePropertyWrongSpecifierEmbeddedMapIndexOne() { exceptionIsThrown = true; assertEquals( e.getMessage(), - "Illegal field name format, should be ' [by key|value]' but was 'fEmbeddedMap by ttt'"); + "Illegal field name format, should be ' [by key|value]' but was 'fEmbeddedMap" + + " by ttt'"); } assertTrue(exceptionIsThrown); @@ -2153,8 +2154,8 @@ public void testCreateMapWithoutLinkedType() { assertTrue( e.getMessage() .contains( - "Linked type was not provided. " - + "You should provide linked type for embedded collections that are going to be indexed.")); + "Linked type was not provided. You should provide linked type for embedded" + + " collections that are going to be indexed.")); } } diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CollateTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CollateTest.java index 176c1a4205d..9a798a74f11 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CollateTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CollateTest.java @@ -338,7 +338,8 @@ public void collateThroughSQL() { database .command( new OCommandSQL( - "create index collateTestViaSQL.index on collateTestViaSQL (cip COLLATE CI) NOTUNIQUE")) + "create index collateTestViaSQL.index on collateTestViaSQL (cip COLLATE CI)" + + " NOTUNIQUE")) .execute(); for (int i = 0; i < 10; i++) { diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CompositeIndexWithNullTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CompositeIndexWithNullTest.java index 80c5ad6bda6..b1681d4a197 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CompositeIndexWithNullTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CompositeIndexWithNullTest.java @@ -67,7 +67,8 @@ public void testPointQuery() { .contains("compositeIndexNullPointQueryIndex")); query = - "select from compositeIndexNullPointQueryClass where prop1 = 1 and prop2 = 2 and prop3 is null"; + "select from compositeIndexNullPointQueryClass where prop1 = 1 and prop2 = 2 and prop3 is" + + " null"; result = database.query(query).stream().map((r) -> r.toElement()).collect(Collectors.toList()); Assert.assertEquals(result.size(), 2); @@ -129,7 +130,8 @@ public void testPointQueryInTx() { .contains("compositeIndexNullPointQueryInTxIndex")); query = - "select from compositeIndexNullPointQueryInTxClass where prop1 = 1 and prop2 = 2 and prop3 is null"; + "select from compositeIndexNullPointQueryInTxClass where prop1 = 1 and prop2 = 2 and prop3" + + " is null"; result = database.query(query).stream().map((r) -> r.toElement()).collect(Collectors.toList()); Assert.assertEquals(result.size(), 2); @@ -192,7 +194,8 @@ public void testPointQueryInMiddleTx() { .contains("compositeIndexNullPointQueryInMiddleTxIndex")); query = - "select from compositeIndexNullPointQueryInMiddleTxClass where prop1 = 1 and prop2 = 2 and prop3 is null"; + "select from compositeIndexNullPointQueryInMiddleTxClass where prop1 = 1 and prop2 = 2 and" + + " prop3 is null"; result = database.query(query).stream().map((r) -> r.toElement()).collect(Collectors.toList()); Assert.assertEquals(result.size(), 2); @@ -368,7 +371,8 @@ public void testPointQueryNullInTheMiddle() { .contains("compositeIndexNullPointQueryNullInTheMiddleIndex")); query = - "select from compositeIndexNullPointQueryNullInTheMiddleClass where prop1 = 1 and prop2 is null"; + "select from compositeIndexNullPointQueryNullInTheMiddleClass where prop1 = 1 and prop2 is" + + " null"; result = database.query(query).stream().map((r) -> r.toElement()).collect(Collectors.toList()); Assert.assertEquals(result.size(), 5); @@ -384,7 +388,8 @@ public void testPointQueryNullInTheMiddle() { .contains("compositeIndexNullPointQueryNullInTheMiddleIndex")); query = - "select from compositeIndexNullPointQueryNullInTheMiddleClass where prop1 = 1 and prop2 is null and prop3 = 13"; + "select from compositeIndexNullPointQueryNullInTheMiddleClass where prop1 = 1 and prop2 is" + + " null and prop3 = 13"; result = database.query(query).stream().map((r) -> r.toElement()).collect(Collectors.toList()); Assert.assertEquals(result.size(), 1); @@ -447,7 +452,8 @@ public void testPointQueryNullInTheMiddleInMiddleTx() { .contains("compositeIndexNullPointQueryNullInTheMiddleInMiddleTxIndex")); query = - "select from compositeIndexNullPointQueryNullInTheMiddleInMiddleTxClass where prop1 = 1 and prop2 is null"; + "select from compositeIndexNullPointQueryNullInTheMiddleInMiddleTxClass where prop1 = 1 and" + + " prop2 is null"; result = database.query(query).stream().map((r) -> r.toElement()).collect(Collectors.toList()); Assert.assertEquals(result.size(), 5); @@ -463,7 +469,8 @@ public void testPointQueryNullInTheMiddleInMiddleTx() { .contains("compositeIndexNullPointQueryNullInTheMiddleInMiddleTxIndex")); query = - "select from compositeIndexNullPointQueryNullInTheMiddleInMiddleTxClass where prop1 = 1 and prop2 is null and prop3 = 13"; + "select from compositeIndexNullPointQueryNullInTheMiddleInMiddleTxClass where prop1 = 1 and" + + " prop2 is null and prop3 = 13"; result = database.query(query).stream().map((r) -> r.toElement()).collect(Collectors.toList()); Assert.assertEquals(result.size(), 1); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/ConcurrentSQLBatchUpdateSuperNodeTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/ConcurrentSQLBatchUpdateSuperNodeTest.java index f9ec84d69e0..08b8b14fc74 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/ConcurrentSQLBatchUpdateSuperNodeTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/ConcurrentSQLBatchUpdateSuperNodeTest.java @@ -85,7 +85,8 @@ public void run() { } else if (res instanceof OrientDynaElementIterable) { // System.out.println("RETURNED ITER"); OrientDynaElementIterable it = (OrientDynaElementIterable) res; - for (Object o : it) ; + for (Object o : it) + ; // System.out.println("RETURNED: " + o); } } diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/DatabaseConflictStategyTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/DatabaseConflictStategyTest.java index 4d635f76bf5..fa89b78e93c 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/DatabaseConflictStategyTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/DatabaseConflictStategyTest.java @@ -80,7 +80,9 @@ public void printVertex(String info, OrientVertex vtx) { // } } - /** @return */ + /** + * @return + */ public String getDBURL() { return "memory:" + dbName; } diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/DatabaseThreadFactoryTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/DatabaseThreadFactoryTest.java index 8c5506ba3a5..45018771430 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/DatabaseThreadFactoryTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/DatabaseThreadFactoryTest.java @@ -30,7 +30,9 @@ import org.testng.annotations.Parameters; import org.testng.annotations.Test; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ @Test public class DatabaseThreadFactoryTest extends DocumentDBBaseTest { private final OPartitionedDatabasePoolFactory poolFactory = new OPartitionedDatabasePoolFactory(); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/DummyForTestFreeze.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/DummyForTestFreeze.java index b5bdcddf353..daeb1e40446 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/DummyForTestFreeze.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/DummyForTestFreeze.java @@ -1,4 +1,6 @@ package com.orientechnologies.orient.test.database.auto; -/** @author Artem Loginov */ +/** + * @author Artem Loginov + */ public class DummyForTestFreeze {} diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/DummyObject.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/DummyObject.java index 76c741695d9..d2872f37f11 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/DummyObject.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/DummyObject.java @@ -4,7 +4,9 @@ import javax.persistence.Id; import javax.persistence.Version; -/** @author Michael Hiess */ +/** + * @author Michael Hiess + */ public class DummyObject { @Id private Object id; @@ -16,37 +18,51 @@ public class DummyObject { /** */ public DummyObject() {} - /** @param name */ + /** + * @param name + */ public DummyObject(String name) { this.name = name; } - /** @return the id */ + /** + * @return the id + */ public Object getId() { return this.id; } - /** @param id the id to set */ + /** + * @param id the id to set + */ public void setId(Object id) { this.id = id; } - /** @return the version */ + /** + * @return the version + */ public Object getVersion() { return this.version; } - /** @param version the version to set */ + /** + * @param version the version to set + */ public void setVersion(Object version) { this.version = version; } - /** @return the name */ + /** + * @return the name + */ public String getName() { return this.name; } - /** @param name the name to set */ + /** + * @param name the name to set + */ public void setName(String name) { this.name = name; } diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/FetchPlanComplexNestedLevelsTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/FetchPlanComplexNestedLevelsTest.java index 0717ef208ca..8955bf2ac89 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/FetchPlanComplexNestedLevelsTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/FetchPlanComplexNestedLevelsTest.java @@ -61,11 +61,13 @@ else if (followTest.getSuperClass() == null) database .command( - "create edge FollowTest from (select from PersonTest where name = 'A') to (select from PersonTest where name = 'B')") + "create edge FollowTest from (select from PersonTest where name = 'A') to (select from" + + " PersonTest where name = 'B')") .close(); database .command( - "create edge FollowTest from (select from PersonTest where name = 'B') to (select from PersonTest where name = 'C')") + "create edge FollowTest from (select from PersonTest where name = 'B') to (select from" + + " PersonTest where name = 'C')") .close(); } @@ -74,7 +76,8 @@ public void queryAll2() { final List result = database.query( new OSQLSynchQuery( - "select @this.toJSON('fetchPlan:*:2') as json from (select from PersonTest where name='A')")); + "select @this.toJSON('fetchPlan:*:2') as json from (select from PersonTest where" + + " name='A')")); Assert.assertEquals(result.size(), 1); String json = result.get(0).rawField("json"); @@ -91,7 +94,8 @@ public void queryOutWildcard2() { final List result = database.query( new OSQLSynchQuery( - "select @this.toJSON('fetchPlan:out_*:2') as json from (select from PersonTest where name='A')")); + "select @this.toJSON('fetchPlan:out_*:2') as json from (select from PersonTest" + + " where name='A')")); Assert.assertEquals(result.size(), 1); String json = result.get(0).rawField("json"); @@ -108,7 +112,8 @@ public void queryOutOneLevelOnly() { final List result = database.query( new OSQLSynchQuery( - "select @this.toJSON('fetchPlan:[0]out_*:0') as json from (select from PersonTest where name='A')")); + "select @this.toJSON('fetchPlan:[0]out_*:0') as json from (select from PersonTest" + + " where name='A')")); Assert.assertEquals(result.size(), 1); String json = result.get(0).field("json"); @@ -126,7 +131,8 @@ public void startZeroGetOutStar2() { final List result = database.query( new OSQLSynchQuery( - "select @this.toJSON('fetchPlan:[0]out_*:2') as json from (select from PersonTest where name='A')")); + "select @this.toJSON('fetchPlan:[0]out_*:2') as json from (select from PersonTest" + + " where name='A')")); Assert.assertEquals(result.size(), 1); String json = result.get(0).field("json"); @@ -142,7 +148,8 @@ public void start2GetOutStar2() { final List result = database.query( new OSQLSynchQuery( - "select @this.toJSON('fetchPlan:[2]out_*:2') as json from (select from PersonTest where name='A')")); + "select @this.toJSON('fetchPlan:[2]out_*:2') as json from (select from PersonTest" + + " where name='A')")); Assert.assertEquals(result.size(), 1); String json = result.get(0).field("json"); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/FunctionsTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/FunctionsTest.java index 8ced1966c34..4ef8e0aac15 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/FunctionsTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/FunctionsTest.java @@ -44,7 +44,8 @@ public void createFunctionBug2415() { database .command( new OCommandSQL( - "create function FunctionsTest \"return a + b\" PARAMETERS [a,b] IDEMPOTENT true LANGUAGE Javascript")) + "create function FunctionsTest \"return a + b\" PARAMETERS [a,b] IDEMPOTENT" + + " true LANGUAGE Javascript")) .execute(); final ODocument record = result.getRecord(); @@ -128,7 +129,8 @@ public void run() { public void testFunctionDefinitionAndCallWithParams() { database .command( - "create function testParams \"return 'Hello ' + name + ' ' + surname + ' from ' + country;\" PARAMETERS [name,surname,country] LANGUAGE Javascript") + "create function testParams \"return 'Hello ' + name + ' ' + surname + ' from ' +" + + " country;\" PARAMETERS [name,surname,country] LANGUAGE Javascript") .close(); try (OResultSet res1 = @@ -154,7 +156,8 @@ public void testFunctionDefinitionAndCallWithParams() { public void testMapParamToFunction() { database .command( - "create function testMapParamToFunction \"return mapParam.get('foo')[0];\" PARAMETERS [mapParam] LANGUAGE Javascript") + "create function testMapParamToFunction \"return mapParam.get('foo')[0];\" PARAMETERS" + + " [mapParam] LANGUAGE Javascript") .close(); Map params = new HashMap(); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/GEOTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/GEOTest.java index 64414b9ef30..956d4d6eee7 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/GEOTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/GEOTest.java @@ -116,7 +116,8 @@ public void queryDistanceOrdered() { database .command( new OSQLSynchQuery( - "select distance(x, y,52.20472, 0.14056 ) as distance from MapPoint order by distance desc")) + "select distance(x, y,52.20472, 0.14056 ) as distance from MapPoint order by" + + " distance desc")) .execute(); Assert.assertTrue(result.size() != 0); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/GraphDatabaseTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/GraphDatabaseTest.java index 0c5a7f37347..a4b596fe1ef 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/GraphDatabaseTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/GraphDatabaseTest.java @@ -267,7 +267,8 @@ public void nestedQuery() { } String query = - "select name, lat, long, distance(lat,long,51.5,0.08) as distance from (select expand(out('owns')) from V where name = 'UK') order by distance"; + "select name, lat, long, distance(lat,long,51.5,0.08) as distance from (select" + + " expand(out('owns')) from V where name = 'UK') order by distance"; result = database.getRawGraph().query(query).stream().collect(Collectors.toList()); Assert.assertEquals(result.size(), 2); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/IndexTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/IndexTest.java index 8a78bc805ce..e34561549d4 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/IndexTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/IndexTest.java @@ -129,7 +129,8 @@ public void testIndexInUniqueIndex() { database .command( new OSQLSynchQuery( - "SELECT * FROM Profile WHERE nick in ['ZZZJayLongNickIndex0' ,'ZZZJayLongNickIndex1', 'ZZZJayLongNickIndex2']")) + "SELECT * FROM Profile WHERE nick in ['ZZZJayLongNickIndex0'" + + " ,'ZZZJayLongNickIndex1', 'ZZZJayLongNickIndex2']")) .execute(); final List expectedSurnames = @@ -474,8 +475,9 @@ public void testIndexInComplexSelectOne() { database .command( new OSQLSynchQuery( - "select * from Profile where (name = 'Giuseppe' OR name <> 'Napoleone')" - + " AND (nick is not null AND (name = 'Giuseppe' OR name <> 'Napoleone') AND (nick >= 'ZZZJayLongNickIndex3'))")) + "select * from Profile where (name = 'Giuseppe' OR name <> 'Napoleone') AND" + + " (nick is not null AND (name = 'Giuseppe' OR name <> 'Napoleone') AND" + + " (nick >= 'ZZZJayLongNickIndex3'))")) .execute(); if (!oldRecording) { Orient.instance().getProfiler().stopRecording(); @@ -515,9 +517,9 @@ public void testIndexInComplexSelectTwo() { database .command( new OSQLSynchQuery( - "select * from Profile where " - + "((name = 'Giuseppe' OR name <> 'Napoleone')" - + " AND (nick is not null AND (name = 'Giuseppe' OR name <> 'Napoleone') AND (nick >= 'ZZZJayLongNickIndex3' OR nick >= 'ZZZJayLongNickIndex4')))")) + "select * from Profile where ((name = 'Giuseppe' OR name <> 'Napoleone') AND" + + " (nick is not null AND (name = 'Giuseppe' OR name <> 'Napoleone') AND" + + " (nick >= 'ZZZJayLongNickIndex3' OR nick >= 'ZZZJayLongNickIndex4')))")) .execute(); if (!oldRecording) { Orient.instance().getProfiler().stopRecording(); @@ -624,7 +626,8 @@ public void testIndexInNotUniqueIndex() { database .command( new OSQLSynchQuery( - "SELECT * FROM Profile WHERE nick in ['ZZZJayLongNickIndex0' ,'ZZZJayLongNickIndex1', 'ZZZJayLongNickIndex2']")) + "SELECT * FROM Profile WHERE nick in ['ZZZJayLongNickIndex0'" + + " ,'ZZZJayLongNickIndex1', 'ZZZJayLongNickIndex2']")) .execute(); final List expectedSurnames = @@ -1309,7 +1312,8 @@ public void testIndexInCompositeQuery() { .getUnderlying() .query( new OSQLSynchQuery( - "select from CompoundSQLIndexTest2 where address in (select from CompoundSQLIndexTest1 where city='Montreal')")); + "select from CompoundSQLIndexTest2 where address in (select from" + + " CompoundSQLIndexTest1 where city='Montreal')")); Assert.assertEquals(result.size(), 1); Assert.assertEquals(result.get(0).getIdentity(), docTwo.getIdentity()); @@ -1625,7 +1629,8 @@ public void testValuesContainerIsRemovedIfIndexIsRemoved() { database .command( - "create index ValuesContainerIsRemovedIfIndexIsRemovedIndex on ValuesContainerIsRemovedIfIndexIsRemovedClass (val) notunique") + "create index ValuesContainerIsRemovedIfIndexIsRemovedIndex on" + + " ValuesContainerIsRemovedIfIndexIsRemovedClass (val) notunique") .close(); for (int i = 0; i < 10; i++) { diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/IndexTxTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/IndexTxTest.java index c08e97488eb..1846d017128 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/IndexTxTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/IndexTxTest.java @@ -17,7 +17,9 @@ import org.testng.annotations.Parameters; import org.testng.annotations.Test; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ public class IndexTxTest extends DocumentDBBaseTest { @Parameters(value = "url") diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/JSONStreamTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/JSONStreamTest.java index 56d872b7f6f..c165a14c59c 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/JSONStreamTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/JSONStreamTest.java @@ -134,10 +134,10 @@ public void testNumericFloatList() throws IOException { public void testNullity() throws IOException { final ODocument doc = new ODocument(); final String docString = - "{\"gender\":{\"name\":\"Male\"},\"firstName\":\"Jack\",\"lastName\":\"Williams\"," - + "\"phone\":\"561-401-3348\",\"email\":\"0586548571@example.com\",\"address\":{\"street1\":\"Smith Ave\"," - + "\"street2\":null,\"city\":\"GORDONSVILLE\",\"state\":\"VA\",\"code\":\"22942\"}," - + "\"dob\":\"2011-11-17 03:17:04\"}"; + "{\"gender\":{\"name\":\"Male\"},\"firstName\":\"Jack\",\"lastName\":\"Williams\",\"phone\":\"561-401-3348\",\"email\":\"0586548571@example.com\",\"address\":{\"street1\":\"Smith" + + " Ave\"," + + "\"street2\":null,\"city\":\"GORDONSVILLE\",\"state\":\"VA\",\"code\":\"22942\"},\"dob\":\"2011-11-17" + + " 03:17:04\"}"; doc.fromJSON(new ByteArrayInputStream(docString.getBytes(StandardCharsets.UTF_8))); final String json = doc.toJSON(); final ODocument loadedDoc = new ODocument().fromJSON(json); @@ -607,7 +607,9 @@ public void testSpaces() throws IOException { public void testEscaping() throws IOException { final ODocument doc = new ODocument(); final String s = - "{\"name\": \"test\", \"nested\": { \"key\": \"value\", \"anotherKey\": 123 }, \"deep\": {\"deeper\": { \"k\": \"v\",\"quotes\": \"\\\"\\\",\\\"oops\\\":\\\"123\\\"\", \"likeJson\": \"[1,2,3]\",\"spaces\": \"value with spaces\"}}}"; + "{\"name\": \"test\", \"nested\": { \"key\": \"value\", \"anotherKey\": 123 }, \"deep\":" + + " {\"deeper\": { \"k\": \"v\",\"quotes\": \"\\\"\\\",\\\"oops\\\":\\\"123\\\"\"," + + " \"likeJson\": \"[1,2,3]\",\"spaces\": \"value with spaces\"}}}"; doc.fromJSON(new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8))); Assert.assertEquals(doc.field("deep[deeper][quotes]"), "\"\",\"oops\":\"123\""); @@ -879,7 +881,8 @@ public void testNestedLinkCreation() throws IOException { // The link between jamie and tyrion is not saved properly final ODocument tyrionDoc = new ODocument("NestedLinkCreation"); final String jsonString2 = - "{\"@type\":\"d\",\"name\":\"tyrion\",\"emergency_contact\":{\"@type\":\"d\", \"relationship\":\"brother\",\"contact\":" + "{\"@type\":\"d\",\"name\":\"tyrion\",\"emergency_contact\":{\"@type\":\"d\"," + + " \"relationship\":\"brother\",\"contact\":" + jaimeDoc.toJSON() + "}}"; tyrionDoc.fromJSON(new ByteArrayInputStream(jsonString2.getBytes(StandardCharsets.UTF_8))); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/JSONTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/JSONTest.java index 409818212f0..fa947f0e19a 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/JSONTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/JSONTest.java @@ -128,10 +128,10 @@ public void testNumericFloatList() { public void testNullity() { final ODocument doc = new ODocument(); doc.fromJSON( - "{\"gender\":{\"name\":\"Male\"},\"firstName\":\"Jack\",\"lastName\":\"Williams\"," - + "\"phone\":\"561-401-3348\",\"email\":\"0586548571@example.com\",\"address\":{\"street1\":\"Smith Ave\"," - + "\"street2\":null,\"city\":\"GORDONSVILLE\",\"state\":\"VA\",\"code\":\"22942\"}," - + "\"dob\":\"2011-11-17 03:17:04\"}"); + "{\"gender\":{\"name\":\"Male\"},\"firstName\":\"Jack\",\"lastName\":\"Williams\",\"phone\":\"561-401-3348\",\"email\":\"0586548571@example.com\",\"address\":{\"street1\":\"Smith" + + " Ave\"," + + "\"street2\":null,\"city\":\"GORDONSVILLE\",\"state\":\"VA\",\"code\":\"22942\"},\"dob\":\"2011-11-17" + + " 03:17:04\"}"); final String json = doc.toJSON(); final ODocument loadedDoc = new ODocument().fromJSON(json); Assert.assertTrue(doc.hasSameContentOf(loadedDoc)); @@ -428,8 +428,10 @@ public void testFetchedJson() { .registerEntityClasses("com.orientechnologies.orient.test.domain.base"); List result = - database.getUnderlying() - .command("select * from Profile where name = 'Barack' and surname = 'Obama'").stream() + database + .getUnderlying() + .command("select * from Profile where name = 'Barack' and surname = 'Obama'") + .stream() .map((e) -> (ODocument) e.toElement()) .collect(Collectors.toList()); @@ -448,7 +450,8 @@ public void testFetchedJson() { @Test public void testToJSONWithNoLazyLoadAndClosedDatabase() { List result = - database.command("select * from Profile where name = 'Barack' and surname = 'Obama'") + database + .command("select * from Profile where name = 'Barack' and surname = 'Obama'") .stream() .map((e) -> (ODocument) e.toElement()) .collect(Collectors.toList()); @@ -515,7 +518,8 @@ public void testSpecialChar() { public void testArrayOfArray() { final ODocument doc = new ODocument(); doc.fromJSON( - "{\"@type\": \"d\",\"@class\": \"Track\",\"type\": \"LineString\",\"coordinates\": [ [ 100, 0 ], [ 101, 1 ] ]}"); + "{\"@type\": \"d\",\"@class\": \"Track\",\"type\": \"LineString\",\"coordinates\": [ [ 100," + + " 0 ], [ 101, 1 ] ]}"); doc.save(); final ODocument loadedDoc = database.load(doc.getIdentity()); Assert.assertTrue(doc.hasSameContentOf(loadedDoc)); @@ -524,7 +528,8 @@ public void testArrayOfArray() { public void testLongTypes() { final ODocument doc = new ODocument(); doc.fromJSON( - "{\"@type\": \"d\",\"@class\": \"Track\",\"type\": \"LineString\",\"coordinates\": [ [ 32874387347347, 0 ], [ -23736753287327, 1 ] ]}"); + "{\"@type\": \"d\",\"@class\": \"Track\",\"type\": \"LineString\",\"coordinates\": [ [" + + " 32874387347347, 0 ], [ -23736753287327, 1 ] ]}"); doc.save(); final ODocument loadedDoc = database.load(doc.getIdentity()); Assert.assertTrue(doc.hasSameContentOf(loadedDoc)); @@ -657,7 +662,8 @@ public void testNestedJsonCollection() { database .command( - "insert into device (resource_id, domainset) VALUES (0, [ { 'domain' : 'abc' }, { 'domain' : 'pqr' } ])") + "insert into device (resource_id, domainset) VALUES (0, [ { 'domain' : 'abc' }, {" + + " 'domain' : 'pqr' } ])") .close(); OResultSet result = database.query("select from device where domainset.domain contains 'abc'"); @@ -688,7 +694,8 @@ public void testNestedMultiLevelEmbeddedJson() { database .command( - "insert into device (domainset) values ({'domain' : { 'lvlone' : { 'value' : 'five' } } } )") + "insert into device (domainset) values ({'domain' : { 'lvlone' : { 'value' : 'five' } }" + + " } )") .close(); OResultSet result = @@ -714,7 +721,9 @@ public void testSpaces() { public void testEscaping() { ODocument doc = new ODocument(); String s = - "{\"name\": \"test\", \"nested\": { \"key\": \"value\", \"anotherKey\": 123 }, \"deep\": {\"deeper\": { \"k\": \"v\",\"quotes\": \"\\\"\\\",\\\"oops\\\":\\\"123\\\"\", \"likeJson\": \"[1,2,3]\",\"spaces\": \"value with spaces\"}}}"; + "{\"name\": \"test\", \"nested\": { \"key\": \"value\", \"anotherKey\": 123 }, \"deep\":" + + " {\"deeper\": { \"k\": \"v\",\"quotes\": \"\\\"\\\",\\\"oops\\\":\\\"123\\\"\"," + + " \"likeJson\": \"[1,2,3]\",\"spaces\": \"value with spaces\"}}}"; doc.fromJSON(s); Assert.assertEquals(doc.field("deep[deeper][quotes]"), "\"\",\"oops\":\"123\""); @@ -960,7 +969,8 @@ public void testList() throws Exception { public void testEmbeddedRIDBagDeserialisationWhenFieldTypeIsProvided() throws Exception { ODocument documentSource = new ODocument(); documentSource.fromJSON( - "{FirstName:\"Student A 0\",in_EHasGoodStudents:[#57:0],@fieldTypes:\"in_EHasGoodStudents=g\"}"); + "{FirstName:\"Student A" + + " 0\",in_EHasGoodStudents:[#57:0],@fieldTypes:\"in_EHasGoodStudents=g\"}"); ORidBag bag = documentSource.field("in_EHasGoodStudents"); Assert.assertEquals(bag.size(), 1); @@ -983,7 +993,8 @@ public void testNestedLinkCreation() { // The link between jamie and tyrion is not saved properly ODocument tyrionDoc = new ODocument("NestedLinkCreation"); tyrionDoc.fromJSON( - "{\"@type\":\"d\",\"name\":\"tyrion\",\"emergency_contact\":{\"@type\":\"d\", \"relationship\":\"brother\",\"contact\":" + "{\"@type\":\"d\",\"name\":\"tyrion\",\"emergency_contact\":{\"@type\":\"d\"," + + " \"relationship\":\"brother\",\"contact\":" + jaimeDoc.toJSON() + "}}"); tyrionDoc.save(); @@ -1058,7 +1069,8 @@ public void testNestedLinkCreationFieldTypes() { // The link between jamie and tyrion is not saved properly ODocument tyrionDoc = new ODocument("NestedLinkCreationFieldTypes"); tyrionDoc.fromJSON( - "{\"@type\":\"d\",\"name\":\"tyrion\",\"emergency_contact\":{\"@type\":\"d\", \"@fieldTypes\":\"contact=x\",\"relationship\":\"brother\",\"contact\":" + "{\"@type\":\"d\",\"name\":\"tyrion\",\"emergency_contact\":{\"@type\":\"d\"," + + " \"@fieldTypes\":\"contact=x\",\"relationship\":\"brother\",\"contact\":" + jaimeDoc.getIdentity() + "}}"); tyrionDoc.save(); @@ -1315,7 +1327,12 @@ public void testInvalidLink() { public void testOtherJson() { new ODocument() .fromJSON( - "{\"Salary\":1500.0,\"Type\":\"Person\",\"Address\":[{\"Zip\":\"JX2 MSX\",\"Type\":\"Home\",\"Street1\":\"13 Marge Street\",\"Country\":\"Holland\",\"Id\":\"Address-28813211\",\"City\":\"Amsterdam\",\"From\":\"1996-02-01\",\"To\":\"1998-01-01\"},{\"Zip\":\"90210\",\"Type\":\"Work\",\"Street1\":\"100 Hollywood Drive\",\"Country\":\"USA\",\"Id\":\"Address-11595040\",\"City\":\"Los Angeles\",\"From\":\"2009-09-01\"}],\"Id\":\"Person-7464251\",\"Name\":\"Stan\"}"); + "{\"Salary\":1500.0,\"Type\":\"Person\",\"Address\":[{\"Zip\":\"JX2" + + " MSX\",\"Type\":\"Home\",\"Street1\":\"13 Marge" + + " Street\",\"Country\":\"Holland\",\"Id\":\"Address-28813211\",\"City\":\"Amsterdam\",\"From\":\"1996-02-01\",\"To\":\"1998-01-01\"},{\"Zip\":\"90210\",\"Type\":\"Work\",\"Street1\":\"100" + + " Hollywood" + + " Drive\",\"Country\":\"USA\",\"Id\":\"Address-11595040\",\"City\":\"Los" + + " Angeles\",\"From\":\"2009-09-01\"}],\"Id\":\"Person-7464251\",\"Name\":\"Stan\"}"); } @Test diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/JSONTestBenchmark.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/JSONTestBenchmark.java index c206158eb0b..af126349c36 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/JSONTestBenchmark.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/JSONTestBenchmark.java @@ -169,20 +169,20 @@ public void testNumericFloatListStream() throws IOException { public void testNullity() { final ODocument doc = new ODocument(); doc.fromJSON( - "{\"gender\":{\"name\":\"Male\"},\"firstName\":\"Jack\",\"lastName\":\"Williams\"," - + "\"phone\":\"561-401-3348\",\"email\":\"0586548571@example.com\",\"address\":{\"street1\":\"Smith Ave\"," - + "\"street2\":null,\"city\":\"GORDONSVILLE\",\"state\":\"VA\",\"code\":\"22942\"}," - + "\"dob\":\"2011-11-17 03:17:04\"}"); + "{\"gender\":{\"name\":\"Male\"},\"firstName\":\"Jack\",\"lastName\":\"Williams\",\"phone\":\"561-401-3348\",\"email\":\"0586548571@example.com\",\"address\":{\"street1\":\"Smith" + + " Ave\"," + + "\"street2\":null,\"city\":\"GORDONSVILLE\",\"state\":\"VA\",\"code\":\"22942\"},\"dob\":\"2011-11-17" + + " 03:17:04\"}"); } @Benchmark public void testNullityStream() throws IOException { final ODocument doc = new ODocument(); final String json = - "{\"gender\":{\"name\":\"Male\"},\"firstName\":\"Jack\",\"lastName\":\"Williams\"," - + "\"phone\":\"561-401-3348\",\"email\":\"0586548571@example.com\",\"address\":{\"street1\":\"Smith Ave\"," - + "\"street2\":null,\"city\":\"GORDONSVILLE\",\"state\":\"VA\",\"code\":\"22942\"}," - + "\"dob\":\"2011-11-17 03:17:04\"}"; + "{\"gender\":{\"name\":\"Male\"},\"firstName\":\"Jack\",\"lastName\":\"Williams\",\"phone\":\"561-401-3348\",\"email\":\"0586548571@example.com\",\"address\":{\"street1\":\"Smith" + + " Ave\"," + + "\"street2\":null,\"city\":\"GORDONSVILLE\",\"state\":\"VA\",\"code\":\"22942\"},\"dob\":\"2011-11-17" + + " 03:17:04\"}"; doc.fromJSON(new ByteArrayInputStream(json.getBytes(StandardCharsets.UTF_8))); } } diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/LinkListIndexTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/LinkListIndexTest.java index 60a4ef318f0..a1ed809d2f8 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/LinkListIndexTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/LinkListIndexTest.java @@ -19,7 +19,9 @@ import org.testng.annotations.Parameters; import org.testng.annotations.Test; -/** @since 21.03.12 */ +/** + * @since 21.03.12 + */ @Test(groups = {"index"}) public class LinkListIndexTest extends DocumentDBBaseTest { diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/LinkMapIndexTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/LinkMapIndexTest.java index d0780684664..0d9957cf85d 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/LinkMapIndexTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/LinkMapIndexTest.java @@ -20,7 +20,9 @@ import org.testng.annotations.Parameters; import org.testng.annotations.Test; -/** @since 22.03.12 */ +/** + * @since 22.03.12 + */ @SuppressWarnings("deprecation") @Test(groups = {"index"}) public class LinkMapIndexTest extends DocumentDBBaseTest { diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/MultipleDBTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/MultipleDBTest.java index 5bf3c35b4be..54769448479 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/MultipleDBTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/MultipleDBTest.java @@ -42,7 +42,9 @@ import org.testng.annotations.Parameters; import org.testng.annotations.Test; -/** @author Michael Hiess */ +/** + * @author Michael Hiess + */ public class MultipleDBTest extends DocumentDBBaseTest { @Parameters(value = "url") diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/NewTraverseTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/NewTraverseTest.java index 67a40e0d151..3ef08647499 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/NewTraverseTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/NewTraverseTest.java @@ -315,7 +315,8 @@ public void traverseSelectNoInfluence() { result3.close(); OResultSet result4 = database.query( - "select from ( traverse * from Movie while $depth < 2 and ( true = true ) ) where true"); + "select from ( traverse * from Movie while $depth < 2 and ( true = true ) ) where" + + " true"); List list4 = new ArrayList<>(); while (result4.hasNext()) { diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/ORidBagTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/ORidBagTest.java index 994943ae4b5..6217accee9c 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/ORidBagTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/ORidBagTest.java @@ -16,7 +16,6 @@ import com.orientechnologies.orient.core.record.ORecordInternal; import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.record.impl.ODocumentHelper; -import com.orientechnologies.orient.core.storage.OStorage; import com.orientechnologies.orient.core.storage.OStorageProxy; import com.tinkerpop.blueprints.impls.orient.OrientGraph; import com.tinkerpop.blueprints.impls.orient.OrientVertex; @@ -264,9 +263,7 @@ public void testAddRemoveSBTreeContainsValues() { ORID rid = doc.getIdentity(); - OStorage storage = database.getStorage(); database.close(); - storage.close(true, false); database = new ODatabaseDocumentTx(database.getURL()); database.open("admin", "admin"); @@ -337,10 +334,8 @@ public void testAddRemoveDuringIterationSBTreeContainsValues() { ORID rid = doc.getIdentity(); - OStorage storage = database.getStorage(); database.getSharedContext().close(); database.close(); - storage.close(true, false); database.activateOnCurrentThread(); database.resetInitialization(); @@ -456,9 +451,7 @@ public void testAddRemoveNotExisting() { ORID rid = doc.getIdentity(); - OStorage storage = database.getStorage(); database.close(); - storage.close(true, false); database = new ODatabaseDocumentTx(database.getURL()); database.open("admin", "admin"); @@ -614,9 +607,7 @@ public void testAddSBTreeAddInMemoryIterate() { ORID rid = doc.getIdentity(); - OStorage storage = database.getStorage(); database.close(); - storage.close(true, false); database = new ODatabaseDocumentTx(database.getURL()); database.open("admin", "admin"); @@ -736,10 +727,7 @@ public void testAddSBTreeAddInMemoryIterateAndRemove() { doc.save(database.getClusterNameById(database.getDefaultClusterId())); ORID rid = doc.getIdentity(); - - OStorage storage = database.getStorage(); database.close(); - storage.close(true, false); database = new ODatabaseDocumentTx(database.getURL()); database.open("admin", "admin"); @@ -921,9 +909,7 @@ public void testSaveLoad() throws Exception { doc.save(database.getClusterNameById(database.getDefaultClusterId())); final ORID id = doc.getIdentity(); - OStorage storage = database.getStorage(); database.close(); - storage.close(true, false); database = new ODatabaseDocumentTx(database.getURL()); database.open("admin", "admin"); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/OSBTreeRidBagTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/OSBTreeRidBagTest.java index 2dcd42430cf..9035eae7041 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/OSBTreeRidBagTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/OSBTreeRidBagTest.java @@ -43,7 +43,9 @@ import org.testng.annotations.Parameters; import org.testng.annotations.Test; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ @Test public class OSBTreeRidBagTest extends ORidBagTest { private int topThreshold; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/OrderByIndexReuseTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/OrderByIndexReuseTest.java index 5ff4ac1369b..8cb7c064ea6 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/OrderByIndexReuseTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/OrderByIndexReuseTest.java @@ -81,7 +81,8 @@ public void testGreaterThanOrderByAscFirstProperty() { public void testGreaterThanOrderByAscSecondAscThirdProperty() { String query = - "select from OrderByIndexReuse where secondProp > 5 order by secondProp asc, thirdProp asc limit 5"; + "select from OrderByIndexReuse where secondProp > 5 order by secondProp asc, thirdProp asc" + + " limit 5"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 5); @@ -102,7 +103,8 @@ public void testGreaterThanOrderByAscSecondAscThirdProperty() { public void testGreaterThanOrderByDescSecondDescThirdProperty() { String query = - "select from OrderByIndexReuse where secondProp > 5 order by secondProp desc, thirdProp desc limit 5"; + "select from OrderByIndexReuse where secondProp > 5 order by secondProp desc, thirdProp" + + " desc limit 5"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 5); @@ -123,7 +125,8 @@ public void testGreaterThanOrderByDescSecondDescThirdProperty() { public void testGreaterThanOrderByAscSecondDescThirdProperty() { String query = - "select from OrderByIndexReuse where secondProp > 5 order by secondProp asc, thirdProp desc limit 5"; + "select from OrderByIndexReuse where secondProp > 5 order by secondProp asc, thirdProp desc" + + " limit 5"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 5); @@ -185,7 +188,8 @@ public void testGTEOrderByAscFirstProperty() { public void testGTEOrderByAscSecondPropertyAscThirdProperty() { final String query = - "select from OrderByIndexReuse where secondProp >= 5 order by secondProp asc, thirdProp asc limit 5"; + "select from OrderByIndexReuse where secondProp >= 5 order by secondProp asc, thirdProp asc" + + " limit 5"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 5); @@ -210,7 +214,8 @@ public void testGTEOrderByAscSecondPropertyAscThirdProperty() { public void testGTEOrderByDescSecondPropertyDescThirdProperty() { final String query = - "select from OrderByIndexReuse where secondProp >= 5 order by secondProp desc, thirdProp desc limit 5"; + "select from OrderByIndexReuse where secondProp >= 5 order by secondProp desc, thirdProp" + + " desc limit 5"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 5); @@ -235,7 +240,8 @@ public void testGTEOrderByDescSecondPropertyDescThirdProperty() { public void testGTEOrderByAscSecondPropertyDescThirdProperty() { final String query = - "select from OrderByIndexReuse where secondProp >= 5 order by secondProp asc, thirdProp desc limit 5"; + "select from OrderByIndexReuse where secondProp >= 5 order by secondProp asc, thirdProp" + + " desc limit 5"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 5); @@ -297,7 +303,8 @@ public void testLTOrderByAscFirstProperty() { public void testLTOrderByAscSecondAscThirdProperty() { final String query = - "select from OrderByIndexReuse where secondProp < 5 order by secondProp asc, thirdProp asc limit 3"; + "select from OrderByIndexReuse where secondProp < 5 order by secondProp asc, thirdProp asc" + + " limit 3"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 3); @@ -323,7 +330,8 @@ public void testLTOrderByAscSecondAscThirdProperty() { public void testLTOrderByDescSecondDescThirdProperty() { final String query = - "select from OrderByIndexReuse where secondProp < 5 order by secondProp desc, thirdProp desc limit 3"; + "select from OrderByIndexReuse where secondProp < 5 order by secondProp desc, thirdProp" + + " desc limit 3"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 3); @@ -349,7 +357,8 @@ public void testLTOrderByDescSecondDescThirdProperty() { public void testLTOrderByAscSecondDescThirdProperty() { final String query = - "select from OrderByIndexReuse where secondProp < 5 order by secondProp asc, thirdProp desc limit 3"; + "select from OrderByIndexReuse where secondProp < 5 order by secondProp asc, thirdProp desc" + + " limit 3"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 3); @@ -412,7 +421,8 @@ public void testLTEOrderByAscFirstProperty() { public void testLTEOrderByAscSecondAscThirdProperty() { final String query = - "select from OrderByIndexReuse where secondProp <= 5 order by secondProp asc, thirdProp asc limit 3"; + "select from OrderByIndexReuse where secondProp <= 5 order by secondProp asc, thirdProp asc" + + " limit 3"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 3); @@ -438,7 +448,8 @@ public void testLTEOrderByAscSecondAscThirdProperty() { public void testLTEOrderByDescSecondDescThirdProperty() { final String query = - "select from OrderByIndexReuse where secondProp <= 5 order by secondProp desc, thirdProp desc limit 3"; + "select from OrderByIndexReuse where secondProp <= 5 order by secondProp desc, thirdProp" + + " desc limit 3"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 3); @@ -464,7 +475,8 @@ public void testLTEOrderByDescSecondDescThirdProperty() { public void testLTEOrderByAscSecondDescThirdProperty() { final String query = - "select from OrderByIndexReuse where secondProp <= 5 order by secondProp asc, thirdProp desc limit 3"; + "select from OrderByIndexReuse where secondProp <= 5 order by secondProp asc, thirdProp" + + " desc limit 3"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 3); @@ -527,7 +539,8 @@ public void testBetweenOrderByAscFirstProperty() { public void testBetweenOrderByAscSecondAscThirdProperty() { final String query = - "select from OrderByIndexReuse where secondProp between 5 and 15 order by secondProp asc, thirdProp asc limit 5"; + "select from OrderByIndexReuse where secondProp between 5 and 15 order by secondProp asc," + + " thirdProp asc limit 5"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 5); @@ -553,7 +566,8 @@ public void testBetweenOrderByAscSecondAscThirdProperty() { public void testBetweenOrderByDescSecondDescThirdProperty() { final String query = - "select from OrderByIndexReuse where secondProp between 5 and 15 order by secondProp desc, thirdProp desc limit 5"; + "select from OrderByIndexReuse where secondProp between 5 and 15 order by secondProp desc," + + " thirdProp desc limit 5"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 5); @@ -579,7 +593,8 @@ public void testBetweenOrderByDescSecondDescThirdProperty() { public void testBetweenOrderByAscSecondDescThirdProperty() { final String query = - "select from OrderByIndexReuse where secondProp between 5 and 15 order by secondProp asc, thirdProp desc limit 5"; + "select from OrderByIndexReuse where secondProp between 5 and 15 order by secondProp asc," + + " thirdProp desc limit 5"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 5); @@ -602,7 +617,8 @@ public void testBetweenOrderByAscSecondDescThirdProperty() { public void testBetweenOrderByDescFirstProperty() { final String query = - "select from OrderByIndexReuse where firstProp between 5 and 15 order by firstProp desc limit 5"; + "select from OrderByIndexReuse where firstProp between 5 and 15 order by firstProp desc" + + " limit 5"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 5); @@ -622,7 +638,8 @@ public void testBetweenOrderByDescFirstProperty() { public void testInOrderByAscFirstProperty() { final String query = - "select from OrderByIndexReuse where firstProp in [10, 2, 43, 21, 45, 47, 11, 12] order by firstProp limit 3"; + "select from OrderByIndexReuse where firstProp in [10, 2, 43, 21, 45, 47, 11, 12] order by" + + " firstProp limit 3"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 3); @@ -647,7 +664,8 @@ public void testInOrderByAscFirstProperty() { public void testInOrderByDescFirstProperty() { final String query = - "select from OrderByIndexReuse where firstProp in [10, 2, 43, 21, 45, 47, 11, 12] order by firstProp desc limit 3"; + "select from OrderByIndexReuse where firstProp in [10, 2, 43, 21, 45, 47, 11, 12] order by" + + " firstProp desc limit 3"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 3); @@ -672,7 +690,8 @@ public void testInOrderByDescFirstProperty() { public void testGreaterThanOrderByAscFirstAscFourthProperty() { String query = - "select from OrderByIndexReuse where firstProp > 5 order by firstProp asc, prop4 asc limit 5"; + "select from OrderByIndexReuse where firstProp > 5 order by firstProp asc, prop4 asc limit" + + " 5"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 5); @@ -693,7 +712,8 @@ public void testGreaterThanOrderByAscFirstAscFourthProperty() { public void testGreaterThanOrderByDescFirstPropertyAscFourthProperty() { final String query = - "select from OrderByIndexReuse where firstProp > 5 order by firstProp desc, prop4 asc limit 5"; + "select from OrderByIndexReuse where firstProp > 5 order by firstProp desc, prop4 asc limit" + + " 5"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 5); @@ -718,7 +738,8 @@ public void testGreaterThanOrderByDescFirstPropertyAscFourthProperty() { public void testGTEOrderByAscFirstPropertyAscFourthProperty() { final String query = - "select from OrderByIndexReuse where firstProp >= 5 order by firstProp asc, prop4 asc limit 5"; + "select from OrderByIndexReuse where firstProp >= 5 order by firstProp asc, prop4 asc limit" + + " 5"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 5); @@ -744,7 +765,8 @@ public void testGTEOrderByAscFirstPropertyAscFourthProperty() { public void testGTEOrderByDescFirstPropertyAscFourthProperty() { final String query = - "select from OrderByIndexReuse where firstProp >= 5 order by firstProp desc, prop4 asc limit 5"; + "select from OrderByIndexReuse where firstProp >= 5 order by firstProp desc, prop4 asc" + + " limit 5"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 5); @@ -770,7 +792,8 @@ public void testGTEOrderByDescFirstPropertyAscFourthProperty() { public void testLTOrderByAscFirstPropertyAscFourthProperty() { final String query = - "select from OrderByIndexReuse where firstProp < 5 order by firstProp asc, prop4 asc limit 3"; + "select from OrderByIndexReuse where firstProp < 5 order by firstProp asc, prop4 asc limit" + + " 3"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 3); @@ -796,7 +819,8 @@ public void testLTOrderByAscFirstPropertyAscFourthProperty() { public void testLTOrderByDescFirstPropertyAscFourthProperty() { final String query = - "select from OrderByIndexReuse where firstProp < 5 order by firstProp desc, prop4 asc limit 3"; + "select from OrderByIndexReuse where firstProp < 5 order by firstProp desc, prop4 asc limit" + + " 3"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 3); @@ -822,7 +846,8 @@ public void testLTOrderByDescFirstPropertyAscFourthProperty() { public void testLTEOrderByAscFirstPropertyAscFourthProperty() { final String query = - "select from OrderByIndexReuse where firstProp <= 5 order by firstProp asc, prop4 asc limit 3"; + "select from OrderByIndexReuse where firstProp <= 5 order by firstProp asc, prop4 asc limit" + + " 3"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 3); @@ -848,7 +873,8 @@ public void testLTEOrderByAscFirstPropertyAscFourthProperty() { public void testLTEOrderByDescFirstPropertyAscFourthProperty() { final String query = - "select from OrderByIndexReuse where firstProp <= 5 order by firstProp desc, prop4 asc limit 3"; + "select from OrderByIndexReuse where firstProp <= 5 order by firstProp desc, prop4 asc" + + " limit 3"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 3); @@ -874,7 +900,8 @@ public void testLTEOrderByDescFirstPropertyAscFourthProperty() { public void testBetweenOrderByAscFirstPropertyAscFourthProperty() { final String query = - "select from OrderByIndexReuse where firstProp between 5 and 15 order by firstProp asc, prop4 asc limit 5"; + "select from OrderByIndexReuse where firstProp between 5 and 15 order by firstProp asc," + + " prop4 asc limit 5"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 5); @@ -900,7 +927,8 @@ public void testBetweenOrderByAscFirstPropertyAscFourthProperty() { public void testBetweenOrderByDescFirstPropertyAscFourthProperty() { final String query = - "select from OrderByIndexReuse where firstProp between 5 and 15 order by firstProp desc, prop4 asc limit 5"; + "select from OrderByIndexReuse where firstProp between 5 and 15 order by firstProp desc," + + " prop4 asc limit 5"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 5); @@ -926,7 +954,8 @@ public void testBetweenOrderByDescFirstPropertyAscFourthProperty() { public void testInOrderByAscFirstPropertyAscFourthProperty() { final String query = - "select from OrderByIndexReuse where firstProp in [10, 2, 43, 21, 45, 47, 11, 12] order by firstProp asc, prop4 asc limit 3"; + "select from OrderByIndexReuse where firstProp in [10, 2, 43, 21, 45, 47, 11, 12] order by" + + " firstProp asc, prop4 asc limit 3"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 3); @@ -954,7 +983,8 @@ public void testInOrderByAscFirstPropertyAscFourthProperty() { public void testInOrderByDescFirstPropertyAscFourthProperty() { final String query = - "select from OrderByIndexReuse where firstProp in [10, 2, 43, 21, 45, 47, 11, 12] order by firstProp desc, prop4 asc limit 3"; + "select from OrderByIndexReuse where firstProp in [10, 2, 43, 21, 45, 47, 11, 12] order by" + + " firstProp desc, prop4 asc limit 3"; List result = database.query(new OSQLSynchQuery(query)); Assert.assertEquals(result.size(), 3); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/PolymorphicQueryTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/PolymorphicQueryTest.java index aa4feb65868..83479f7cd5c 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/PolymorphicQueryTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/PolymorphicQueryTest.java @@ -34,7 +34,9 @@ import org.testng.annotations.Parameters; import org.testng.annotations.Test; -/** @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +/** + * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) + */ public class PolymorphicQueryTest extends DocumentDBBaseTest { @Parameters(value = "url") @@ -55,7 +57,8 @@ public void beforeClass() throws Exception { .close(); database .command( - "create index IndexInSubclassesTestChild1.name on IndexInSubclassesTestChild1 (name) notunique") + "create index IndexInSubclassesTestChild1.name on IndexInSubclassesTestChild1 (name)" + + " notunique") .close(); database @@ -63,7 +66,8 @@ public void beforeClass() throws Exception { .close(); database .command( - "create index IndexInSubclassesTestChild2.name on IndexInSubclassesTestChild2 (name) notunique") + "create index IndexInSubclassesTestChild2.name on IndexInSubclassesTestChild2 (name)" + + " notunique") .close(); database.command("create class IndexInSubclassesTestBaseFail").close(); @@ -84,7 +88,8 @@ public void beforeClass() throws Exception { .close(); database .command( - "create index IndexInSubclassesTestChild2Fail.name on IndexInSubclassesTestChild2Fail (name) notunique") + "create index IndexInSubclassesTestChild2Fail.name on IndexInSubclassesTestChild2Fail" + + " (name) notunique") .close(); database.command("create class GenericCrash").close(); @@ -143,7 +148,8 @@ public void testSubclassesIndexes() throws Exception { List result = database.query( new OSQLSynchQuery( - "select from IndexInSubclassesTestBase where name > 'name9995' and name < 'name9999' order by name ASC")); + "select from IndexInSubclassesTestBase where name > 'name9995' and name <" + + " 'name9999' order by name ASC")); Assert.assertEquals(result.size(), 6); String lastName = result.get(0).field("name"); @@ -161,7 +167,8 @@ public void testSubclassesIndexes() throws Exception { result = database.query( new OSQLSynchQuery( - "select from IndexInSubclassesTestBase where name > 'name9995' and name < 'name9999' order by name DESC")); + "select from IndexInSubclassesTestBase where name > 'name9995' and name <" + + " 'name9999' order by name DESC")); Assert.assertEquals(result.size(), 6); lastName = result.get(0).field("name"); for (int i = 1; i < result.size(); i++) { @@ -212,7 +219,8 @@ public void testBaseWithoutIndexAndSubclassesIndexes() throws Exception { List result = database.query( new OSQLSynchQuery( - "select from IndexInSubclassesTestBase where name > 'name9995' and name < 'name9999' order by name ASC")); + "select from IndexInSubclassesTestBase where name > 'name9995' and name <" + + " 'name9999' order by name ASC")); Assert.assertTrue(result.size() == 9); String lastName = result.get(0).field("name"); for (int i = 1; i < result.size(); i++) { @@ -230,7 +238,8 @@ public void testBaseWithoutIndexAndSubclassesIndexes() throws Exception { result = database.query( new OSQLSynchQuery( - "select from IndexInSubclassesTestBase where name > 'name9995' and name < 'name9999' order by name DESC")); + "select from IndexInSubclassesTestBase where name > 'name9995' and name <" + + " 'name9999' order by name DESC")); Assert.assertTrue(result.size() == 9); lastName = result.get(0).field("name"); for (int i = 1; i < result.size(); i++) { @@ -277,7 +286,8 @@ public void testSubclassesIndexesFailed() throws Exception { OResultSet result = database.query( - "select from IndexInSubclassesTestBaseFail where name > 'name9995' and name < 'name9999' order by name ASC"); + "select from IndexInSubclassesTestBaseFail where name > 'name9995' and name <" + + " 'name9999' order by name ASC"); Assert.assertTrue(result.stream().count() == 6); long lastIndexUsage = profiler.getCounter("db.demo.query.indexUsed"); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/PreparedStatementTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/PreparedStatementTest.java index 8d92aefcb9b..81465ab237c 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/PreparedStatementTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/PreparedStatementTest.java @@ -297,7 +297,8 @@ public void testSubqueryNamedParamFlat() { params.put("name", "foo1"); OResultSet result = database.query( - "select from (select from PreparedStatementTest1 where name = :name) where name = :name", + "select from (select from PreparedStatementTest1 where name = :name) where name =" + + " :name", params); boolean found = false; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/RemoteProtocolCommandsTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/RemoteProtocolCommandsTest.java index 37d31472269..d7c98d93fcf 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/RemoteProtocolCommandsTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/RemoteProtocolCommandsTest.java @@ -18,7 +18,9 @@ import org.testng.annotations.Parameters; import org.testng.annotations.Test; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ @Test(groups = "db") public class RemoteProtocolCommandsTest extends DocumentDBBaseTest { private static final String serverPort = System.getProperty("orient.server.port", "2424"); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLCreateIndexTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLCreateIndexTest.java index 4a5b33e9012..6a26f0f5084 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLCreateIndexTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLCreateIndexTest.java @@ -90,7 +90,8 @@ public void testOldSyntax() throws Exception { public void testCreateCompositeIndex() throws Exception { database .command( - "CREATE INDEX sqlCreateIndexCompositeIndex ON sqlCreateIndexTestClass (prop1, prop2) UNIQUE") + "CREATE INDEX sqlCreateIndexCompositeIndex ON sqlCreateIndexTestClass (prop1, prop2)" + + " UNIQUE") .close(); database.getMetadata().getIndexManagerInternal().reload(); @@ -170,7 +171,8 @@ public void testCreateEmbeddedMapWrongSpecifierIndexOne() throws Exception { try { database .command( - "CREATE INDEX sqlCreateIndexEmbeddedMapWrongSpecifierIndex ON sqlCreateIndexTestClass (prop3 by ttt) UNIQUE") + "CREATE INDEX sqlCreateIndexEmbeddedMapWrongSpecifierIndex ON sqlCreateIndexTestClass" + + " (prop3 by ttt) UNIQUE") .close(); Assert.fail(); } catch (OCommandSQLParsingException e) { @@ -190,7 +192,8 @@ public void testCreateEmbeddedMapWrongSpecifierIndexTwo() throws Exception { try { database .command( - "CREATE INDEX sqlCreateIndexEmbeddedMapWrongSpecifierIndex ON sqlCreateIndexTestClass (prop3 b value) UNIQUE") + "CREATE INDEX sqlCreateIndexEmbeddedMapWrongSpecifierIndex ON sqlCreateIndexTestClass" + + " (prop3 b value) UNIQUE") .close(); Assert.fail(); } catch (OCommandSQLParsingException e) { @@ -211,7 +214,8 @@ public void testCreateEmbeddedMapWrongSpecifierIndexThree() throws Exception { try { database .command( - "CREATE INDEX sqlCreateIndexEmbeddedMapWrongSpecifierIndex ON sqlCreateIndexTestClass (prop3 by value t) UNIQUE") + "CREATE INDEX sqlCreateIndexEmbeddedMapWrongSpecifierIndex ON sqlCreateIndexTestClass" + + " (prop3 by value t) UNIQUE") .close(); Assert.fail(); } catch (OCommandSQLParsingException e) { @@ -231,7 +235,8 @@ public void testCreateEmbeddedMapWrongSpecifierIndexThree() throws Exception { public void testCreateEmbeddedMapByKeyIndex() throws Exception { database .command( - "CREATE INDEX sqlCreateIndexEmbeddedMapByKeyIndex ON sqlCreateIndexTestClass (prop3 by key) UNIQUE") + "CREATE INDEX sqlCreateIndexEmbeddedMapByKeyIndex ON sqlCreateIndexTestClass (prop3 by" + + " key) UNIQUE") .close(); database.getMetadata().getIndexManagerInternal().reload(); @@ -259,7 +264,8 @@ public void testCreateEmbeddedMapByKeyIndex() throws Exception { public void testCreateEmbeddedMapByValueIndex() throws Exception { database .command( - "CREATE INDEX sqlCreateIndexEmbeddedMapByValueIndex ON sqlCreateIndexTestClass (prop3 by value) UNIQUE") + "CREATE INDEX sqlCreateIndexEmbeddedMapByValueIndex ON sqlCreateIndexTestClass (prop3" + + " by value) UNIQUE") .close(); database.getMetadata().getIndexManagerInternal().reload(); @@ -287,7 +293,8 @@ public void testCreateEmbeddedMapByValueIndex() throws Exception { public void testCreateEmbeddedListIndex() throws Exception { database .command( - "CREATE INDEX sqlCreateIndexEmbeddedListIndex ON sqlCreateIndexTestClass (prop5) NOTUNIQUE") + "CREATE INDEX sqlCreateIndexEmbeddedListIndex ON sqlCreateIndexTestClass (prop5)" + + " NOTUNIQUE") .close(); database.getMetadata().getIndexManagerInternal().reload(); @@ -379,15 +386,16 @@ public void testCreateEmbeddedListWithoutLinkedTypeIndex() throws Exception { try { database .command( - "CREATE INDEX sqlCreateIndexEmbeddedListWithoutLinkedTypeIndex ON sqlCreateIndexTestClass (prop6) UNIQUE") + "CREATE INDEX sqlCreateIndexEmbeddedListWithoutLinkedTypeIndex ON" + + " sqlCreateIndexTestClass (prop6) UNIQUE") .close(); Assert.fail(); } catch (OIndexException e) { Assert.assertTrue( e.getMessage() .contains( - "Linked type was not provided. " - + "You should provide linked type for embedded collections that are going to be indexed.")); + "Linked type was not provided. You should provide linked type for embedded" + + " collections that are going to be indexed.")); } final OIndex index = database @@ -404,15 +412,16 @@ public void testCreateEmbeddedMapWithoutLinkedTypeIndex() throws Exception { try { database .command( - "CREATE INDEX sqlCreateIndexEmbeddedMapWithoutLinkedTypeIndex ON sqlCreateIndexTestClass (prop7 by value) UNIQUE") + "CREATE INDEX sqlCreateIndexEmbeddedMapWithoutLinkedTypeIndex ON" + + " sqlCreateIndexTestClass (prop7 by value) UNIQUE") .close(); Assert.fail(); } catch (OIndexException e) { Assert.assertTrue( e.getMessage() .contains( - "Linked type was not provided. " - + "You should provide linked type for embedded collections that are going to be indexed.")); + "Linked type was not provided. You should provide linked type for embedded" + + " collections that are going to be indexed.")); } final OIndex index = database @@ -428,7 +437,8 @@ public void testCreateEmbeddedMapWithoutLinkedTypeIndex() throws Exception { public void testCreateCompositeIndexWithTypes() throws Exception { final String query = new StringBuilder( - "CREATE INDEX sqlCreateIndexCompositeIndex2 ON sqlCreateIndexTestClass (prop1, prop2) UNIQUE ") + "CREATE INDEX sqlCreateIndexCompositeIndex2 ON sqlCreateIndexTestClass (prop1," + + " prop2) UNIQUE ") .append(EXPECTED_PROP1_TYPE) .append(", ") .append(EXPECTED_PROP2_TYPE) @@ -459,7 +469,8 @@ public void testCreateCompositeIndexWithTypes() throws Exception { public void testCreateCompositeIndexWithWrongTypes() throws Exception { final String query = new StringBuilder( - "CREATE INDEX sqlCreateIndexCompositeIndex3 ON sqlCreateIndexTestClass (prop1, prop2) UNIQUE ") + "CREATE INDEX sqlCreateIndexCompositeIndex3 ON sqlCreateIndexTestClass (prop1," + + " prop2) UNIQUE ") .append(EXPECTED_PROP1_TYPE) .append(", ") .append(EXPECTED_PROP1_TYPE) @@ -472,7 +483,8 @@ public void testCreateCompositeIndexWithWrongTypes() throws Exception { Assert.assertTrue( e.getMessage() .contains( - "Error on execution of command: sql.CREATE INDEX sqlCreateIndexCompositeIndex3 ON")); + "Error on execution of command: sql.CREATE INDEX sqlCreateIndexCompositeIndex3" + + " ON")); Throwable cause = e; while (cause.getCause() != null) cause = cause.getCause(); @@ -492,8 +504,8 @@ public void testCreateCompositeIndexWithWrongTypes() throws Exception { public void testCompositeIndexWithMetadata() { database .command( - "CREATE INDEX sqlCreateIndexCompositeIndexWithMetadata ON sqlCreateIndexTestClass (prop1, prop2) UNIQUE" - + " metadata {v1:23, v2:\"val2\"}") + "CREATE INDEX sqlCreateIndexCompositeIndexWithMetadata ON sqlCreateIndexTestClass" + + " (prop1, prop2) UNIQUE metadata {v1:23, v2:\"val2\"}") .close(); database.getMetadata().getIndexManagerInternal().reload(); @@ -552,7 +564,8 @@ public void testOldIndexWithMetadata() { public void testCreateCompositeIndexWithTypesAndMetadata() throws Exception { final String query = new StringBuilder( - "CREATE INDEX sqlCreateIndexCompositeIndex2WithConfig ON sqlCreateIndexTestClass (prop1, prop2) UNIQUE ") + "CREATE INDEX sqlCreateIndexCompositeIndex2WithConfig ON sqlCreateIndexTestClass" + + " (prop1, prop2) UNIQUE ") .append(EXPECTED_PROP1_TYPE) .append(", ") .append(EXPECTED_PROP2_TYPE) diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLCreateLinkTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLCreateLinkTest.java index df65f82493e..c7fcadef655 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLCreateLinkTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLCreateLinkTest.java @@ -100,7 +100,8 @@ public void createLinktest() { database .command( new OCommandSQL( - "CREATE LINK comments TYPE LINKSET FROM comment.postId TO post.id INVERSE")) + "CREATE LINK comments TYPE LINKSET FROM comment.postId TO post.id" + + " INVERSE")) .execute()) .intValue(), 5); @@ -192,7 +193,8 @@ public void createRIDLinktest() { database .command( new OCommandSQL( - "CREATE LINK comments TYPE LINKSET FROM comment2.postId TO post2.@rid INVERSE")) + "CREATE LINK comments TYPE LINKSET FROM comment2.postId TO post2.@rid" + + " INVERSE")) .execute()) .intValue(), 5); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLDropClassIndexTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLDropClassIndexTest.java index 55d9d7e22de..f97e99acc31 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLDropClassIndexTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLDropClassIndexTest.java @@ -69,7 +69,8 @@ public void afterMethod() { public void testIndexDeletion() throws Exception { database .command( - "CREATE INDEX SQLDropClassCompositeIndex ON SQLDropClassTestClass (prop1, prop2) UNIQUE") + "CREATE INDEX SQLDropClassCompositeIndex ON SQLDropClassTestClass (prop1, prop2)" + + " UNIQUE") .close(); database.getMetadata().getIndexManagerInternal().reload(); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLDropIndexTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLDropIndexTest.java index af1675df7e2..bd5467a464d 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLDropIndexTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLDropIndexTest.java @@ -105,7 +105,8 @@ public void testOldSyntax() throws Exception { public void testDropCompositeIndex() throws Exception { database .command( - "CREATE INDEX SQLDropIndexCompositeIndex ON SQLDropIndexTestClass (prop1, prop2) UNIQUE") + "CREATE INDEX SQLDropIndexCompositeIndex ON SQLDropIndexTestClass (prop1, prop2)" + + " UNIQUE") .close(); ((OMetadataDefault) database.getMetadata()).getIndexManagerInternal().reload(); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLDropPropertyIndexTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLDropPropertyIndexTest.java index f9f57dc8bf1..80a8622604b 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLDropPropertyIndexTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLDropPropertyIndexTest.java @@ -63,7 +63,8 @@ public void afterMethod() throws Exception { public void testForcePropertyEnabled() throws Exception { database .command( - "CREATE INDEX DropPropertyIndexCompositeIndex ON DropPropertyIndexTestClass (prop2, prop1) UNIQUE") + "CREATE INDEX DropPropertyIndexCompositeIndex ON DropPropertyIndexTestClass (prop2," + + " prop1) UNIQUE") .close(); database.getMetadata().getIndexManagerInternal().reload(); @@ -92,7 +93,8 @@ public void testForcePropertyEnabled() throws Exception { public void testForcePropertyEnabledBrokenCase() throws Exception { database .command( - "CREATE INDEX DropPropertyIndexCompositeIndex ON DropPropertyIndexTestClass (prop2, prop1) UNIQUE") + "CREATE INDEX DropPropertyIndexCompositeIndex ON DropPropertyIndexTestClass (prop2," + + " prop1) UNIQUE") .close(); database.getMetadata().getIndexManagerInternal().reload(); @@ -121,7 +123,8 @@ public void testForcePropertyEnabledBrokenCase() throws Exception { public void testForcePropertyDisabled() throws Exception { database .command( - "CREATE INDEX DropPropertyIndexCompositeIndex ON DropPropertyIndexTestClass (prop1, prop2) UNIQUE") + "CREATE INDEX DropPropertyIndexCompositeIndex ON DropPropertyIndexTestClass (prop1," + + " prop2) UNIQUE") .close(); database.getMetadata().getIndexManagerInternal().reload(); @@ -140,9 +143,8 @@ public void testForcePropertyDisabled() throws Exception { Assert.assertTrue( e.getMessage() .contains( - "Property used in indexes (" - + "DropPropertyIndexCompositeIndex" - + "). Please drop these indexes before removing property or use FORCE parameter.")); + "Property used in indexes (DropPropertyIndexCompositeIndex). Please drop these" + + " indexes before removing property or use FORCE parameter.")); } database.getMetadata().getIndexManagerInternal().reload(); @@ -169,7 +171,8 @@ public void testForcePropertyDisabled() throws Exception { public void testForcePropertyDisabledBrokenCase() throws Exception { database .command( - "CREATE INDEX DropPropertyIndexCompositeIndex ON DropPropertyIndexTestClass (prop1, prop2) UNIQUE") + "CREATE INDEX DropPropertyIndexCompositeIndex ON DropPropertyIndexTestClass (prop1," + + " prop2) UNIQUE") .close(); try { @@ -179,9 +182,8 @@ public void testForcePropertyDisabledBrokenCase() throws Exception { Assert.assertTrue( e.getMessage() .contains( - "Property used in indexes (" - + "DropPropertyIndexCompositeIndex" - + "). Please drop these indexes before removing property or use FORCE parameter.")); + "Property used in indexes (DropPropertyIndexCompositeIndex). Please drop these" + + " indexes before removing property or use FORCE parameter.")); } database.getMetadata().getIndexManagerInternal().reload(); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLFunctionsTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLFunctionsTest.java index 8b1df40911b..8fa53156d7c 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLFunctionsTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLFunctionsTest.java @@ -368,7 +368,8 @@ public void queryComposedAggregates() { database .command( new OSQLSynchQuery( - "select MIN(id) as min, max(id) as max, AVG(id) as average, sum(id) as total from Account")) + "select MIN(id) as min, max(id) as max, AVG(id) as average, sum(id) as total" + + " from Account")) .execute(); Assert.assertTrue(result.size() == 1); @@ -394,7 +395,8 @@ public void queryFormat() { database .command( new OSQLSynchQuery( - "select format('%d - %s (%s)', nr, street, type, dummy ) as output from Account")) + "select format('%d - %s (%s)', nr, street, type, dummy ) as output from" + + " Account")) .execute(); Assert.assertTrue(result.size() > 1); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLInsertTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLInsertTest.java index 57feaf99e05..596860d9e2c 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLInsertTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLInsertTest.java @@ -83,7 +83,8 @@ public void insertOperator() { database .command( new OCommandSQL( - "insert into Profile (name, surname, salary, location, dummy) values ('Luca','Smith', 109.9, #" + "insert into Profile (name, surname, salary, location, dummy) values" + + " ('Luca','Smith', 109.9, #" + addressId + ":" + positions.get(3) @@ -102,7 +103,8 @@ public void insertOperator() { database .command( new OCommandSQL( - "insert into Profile SET name = 'Luca', surname = 'Smith', salary = 109.9, location = #" + "insert into Profile SET name = 'Luca', surname = 'Smith', salary = 109.9," + + " location = #" + addressId + ":" + positions.get(3) @@ -131,7 +133,8 @@ public void insertWithWildcards() { database .command( new OCommandSQL( - "insert into Profile (name, surname, salary, location, dummy) values (?,?,?,?,?)")) + "insert into Profile (name, surname, salary, location, dummy) values" + + " (?,?,?,?,?)")) .execute( "Marc", "Smith", 120.0, new ORecordId(addressId, positions.get(3)), "hooray"); @@ -149,7 +152,8 @@ public void insertWithWildcards() { database .command( new OCommandSQL( - "insert into Profile SET name = ?, surname = ?, salary = ?, location = ?, dummy = ?")) + "insert into Profile SET name = ?, surname = ?, salary = ?, location = ?," + + " dummy = ?")) .execute( "Marc", "Smith", 120.0, new ORecordId(addressId, positions.get(3)), "hooray"); @@ -170,7 +174,8 @@ public void insertMap() { database .command( new OCommandSQL( - "insert into cluster:default (equaledges, name, properties) values ('no', 'circle', {'round':'eeee', 'blaaa':'zigzag'} )")) + "insert into cluster:default (equaledges, name, properties) values ('no'," + + " 'circle', {'round':'eeee', 'blaaa':'zigzag'} )")) .execute(); Assert.assertTrue(doc != null); @@ -194,7 +199,8 @@ public void insertMap() { database .command( new OCommandSQL( - "insert into cluster:default SET equaledges = 'no', name = 'circle', properties = {'round':'eeee', 'blaaa':'zigzag'} ")) + "insert into cluster:default SET equaledges = 'no', name = 'circle'," + + " properties = {'round':'eeee', 'blaaa':'zigzag'} ")) .execute(); Assert.assertTrue(doc != null); @@ -220,7 +226,8 @@ public void insertList() { database .command( new OCommandSQL( - "insert into cluster:default (equaledges, name, list) values ('yes', 'square', ['bottom', 'top','left','right'] )")) + "insert into cluster:default (equaledges, name, list) values ('yes'," + + " 'square', ['bottom', 'top','left','right'] )")) .execute(); Assert.assertTrue(doc != null); @@ -246,7 +253,8 @@ public void insertList() { database .command( new OCommandSQL( - "insert into cluster:default SET equaledges = 'yes', name = 'square', list = ['bottom', 'top','left','right'] ")) + "insert into cluster:default SET equaledges = 'yes', name = 'square', list" + + " = ['bottom', 'top','left','right'] ")) .execute(); Assert.assertTrue(doc != null); @@ -317,7 +325,8 @@ public void insertCluster() { database .command( new OCommandSQL( - "insert into Account cluster anotherdefault (id, title) values (10, 'NoSQL movement')")) + "insert into Account cluster anotherdefault (id, title) values (10, 'NoSQL" + + " movement')")) .execute(); Assert.assertTrue(doc != null); @@ -340,7 +349,8 @@ public void updateMultipleFields() { database .command( new OCommandSQL( - " INSERT INTO Account SET id= 3232,name= 'my name',map= {\"key\":\"value\"},dir= '',user= #3:" + " INSERT INTO Account SET id= 3232,name= 'my name',map=" + + " {\"key\":\"value\"},dir= '',user= #3:" + positions.get(0))) .execute(); Assert.assertNotNull(result); @@ -415,7 +425,8 @@ public void insertWithReturn() { database .command( new OCommandSQL( - "INSERT INTO Actor2(FirstName,LastName) VALUES ('Jay','Miner'),('Frank','Hermier'),('Emily','Saut') RETURN @rid")) + "INSERT INTO Actor2(FirstName,LastName) VALUES" + + " ('Jay','Miner'),('Frank','Hermier'),('Emily','Saut') RETURN @rid")) .execute(); Assert.assertTrue(res2 instanceof List); Assert.assertTrue(((List) res2).get(0) instanceof ORecordId); @@ -472,7 +483,8 @@ public void testAutoConversionOfEmbeddededSetNoLinkedClass() { database .command( new OCommandSQL( - "INSERT INTO TestConvert SET name = 'embeddedSetNoLinkedClass', embeddedSetNoLinkedClass = [{'line1':'123 Fake Street'}]")) + "INSERT INTO TestConvert SET name = 'embeddedSetNoLinkedClass'," + + " embeddedSetNoLinkedClass = [{'line1':'123 Fake Street'}]")) .execute(); Assert.assertTrue(doc.field("embeddedSetNoLinkedClass") instanceof Set); @@ -495,7 +507,8 @@ public void testAutoConversionOfEmbeddededSetWithLinkedClass() { database .command( new OCommandSQL( - "INSERT INTO TestConvert SET name = 'embeddedSetWithLinkedClass', embeddedSetWithLinkedClass = [{'line1':'123 Fake Street'}]")) + "INSERT INTO TestConvert SET name = 'embeddedSetWithLinkedClass'," + + " embeddedSetWithLinkedClass = [{'line1':'123 Fake Street'}]")) .execute(); Assert.assertTrue(doc.field("embeddedSetWithLinkedClass") instanceof Set); @@ -516,7 +529,8 @@ public void testAutoConversionOfEmbeddededListNoLinkedClass() { database .command( new OCommandSQL( - "INSERT INTO TestConvert SET name = 'embeddedListNoLinkedClass', embeddedListNoLinkedClass = [{'line1':'123 Fake Street'}]")) + "INSERT INTO TestConvert SET name = 'embeddedListNoLinkedClass'," + + " embeddedListNoLinkedClass = [{'line1':'123 Fake Street'}]")) .execute(); Assert.assertTrue(doc.field("embeddedListNoLinkedClass") instanceof List); @@ -540,7 +554,8 @@ public void testAutoConversionOfEmbeddededListWithLinkedClass() { database .command( new OCommandSQL( - "INSERT INTO TestConvert SET name = 'embeddedListWithLinkedClass', embeddedListWithLinkedClass = [{'line1':'123 Fake Street'}]")) + "INSERT INTO TestConvert SET name = 'embeddedListWithLinkedClass'," + + " embeddedListWithLinkedClass = [{'line1':'123 Fake Street'}]")) .execute(); Assert.assertTrue(doc.field("embeddedListWithLinkedClass") instanceof List); @@ -561,7 +576,8 @@ public void testAutoConversionOfEmbeddededMapNoLinkedClass() { database .command( new OCommandSQL( - "INSERT INTO TestConvert SET name = 'embeddedMapNoLinkedClass', embeddedMapNoLinkedClass = {test:{'line1':'123 Fake Street'}}")) + "INSERT INTO TestConvert SET name = 'embeddedMapNoLinkedClass'," + + " embeddedMapNoLinkedClass = {test:{'line1':'123 Fake Street'}}")) .execute(); Assert.assertTrue(doc.field("embeddedMapNoLinkedClass") instanceof Map); @@ -584,7 +600,8 @@ public void testAutoConversionOfEmbeddededMapWithLinkedClass() { database .command( new OCommandSQL( - "INSERT INTO TestConvert SET name = 'embeddedMapWithLinkedClass', embeddedMapWithLinkedClass = {test:{'line1':'123 Fake Street'}}")) + "INSERT INTO TestConvert SET name = 'embeddedMapWithLinkedClass'," + + " embeddedMapWithLinkedClass = {test:{'line1':'123 Fake Street'}}")) .execute(); Assert.assertTrue(doc.field("embeddedMapWithLinkedClass") instanceof Map); @@ -605,7 +622,8 @@ public void testAutoConversionOfEmbeddededNoLinkedClass() { database .command( new OCommandSQL( - "INSERT INTO TestConvert SET name = 'embeddedNoLinkedClass', embeddedNoLinkedClass = {'line1':'123 Fake Street'}")) + "INSERT INTO TestConvert SET name = 'embeddedNoLinkedClass'," + + " embeddedNoLinkedClass = {'line1':'123 Fake Street'}")) .execute(); Assert.assertTrue(doc.field("embeddedNoLinkedClass") instanceof ODocument); @@ -617,7 +635,8 @@ public void testEmbeddedDates() { database .command( - "insert into TestEmbeddedDates set events = [{\"on\": date(\"2005-09-08 04:00:00\", \"yyyy-MM-dd HH:mm:ss\", \"UTC\")}]\n") + "insert into TestEmbeddedDates set events = [{\"on\": date(\"2005-09-08 04:00:00\"," + + " \"yyyy-MM-dd HH:mm:ss\", \"UTC\")}]\n") .close(); List result = @@ -653,7 +672,8 @@ public void testAutoConversionOfEmbeddededWithLinkedClass() { database .command( new OCommandSQL( - "INSERT INTO TestConvert SET name = 'embeddedWithLinkedClass', embeddedWithLinkedClass = {'line1':'123 Fake Street'}")) + "INSERT INTO TestConvert SET name = 'embeddedWithLinkedClass'," + + " embeddedWithLinkedClass = {'line1':'123 Fake Street'}")) .execute(); Assert.assertTrue(doc.field("embeddedWithLinkedClass") instanceof ODocument); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLMetadataTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLMetadataTest.java index 41b9fa80c59..17c22125bd2 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLMetadataTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLMetadataTest.java @@ -48,7 +48,8 @@ public void querySchemaProperties() { database .command( new OSQLSynchQuery( - "select expand(properties) from (select expand(classes) from metadata:schema) where name = 'OUser'")) + "select expand(properties) from (select expand(classes) from metadata:schema)" + + " where name = 'OUser'")) .execute(); Assert.assertTrue(result.size() != 0); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectByLinkedPropertyIndexReuseTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectByLinkedPropertyIndexReuseTest.java index de52c251f6a..73ad7f2d791 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectByLinkedPropertyIndexReuseTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectByLinkedPropertyIndexReuseTest.java @@ -360,9 +360,9 @@ private void fillDataSet() { diploma1.field("name", "diploma1"); diploma1.field( "thesis", - "Researching and visiting universities before making a final decision is very " - + "beneficial because you student be able to experience the campus, meet the professors, and truly " - + "understand the traditions of the university."); + "Researching and visiting universities before making a final decision is very beneficial" + + " because you student be able to experience the campus, meet the professors, and" + + " truly understand the traditions of the university."); final ODocument transcript = database.newInstance("lpirtTranscript"); transcript.field("id", "1"); @@ -392,9 +392,9 @@ private void fillDataSet() { diploma2.field("name", "diploma2"); diploma2.field( "thesis", - "While both Northerners and Southerners believed they fought against tyranny and " - + "oppression, Northerners focused on the oppression of slaves while Southerners defended their own " - + "right to self-government."); + "While both Northerners and Southerners believed they fought against tyranny and" + + " oppression, Northerners focused on the oppression of slaves while Southerners" + + " defended their own right to self-government."); final ODocument student2 = database.newInstance("lpirtStudent"); student2.field("name", "Jane Smith"); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectHashIndexReuseTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectHashIndexReuseTest.java index b03c82ba067..9eaf51ceac8 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectHashIndexReuseTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectHashIndexReuseTest.java @@ -114,7 +114,8 @@ public void beforeClass() throws Exception { final String fullTextIndexStrings[] = { "Alice : What is the use of a book, without pictures or conversations?", "Rabbit : Oh my ears and whiskers, how late it's getting!", - "Alice : If it had grown up, it would have made a dreadfully ugly child; but it makes rather a handsome pig, I think", + "Alice : If it had grown up, it would have made a dreadfully ugly child; but it makes rather" + + " a handsome pig, I think", "The Cat : We're all mad here.", "The Hatter : Why is a raven like a writing desk?", "The Hatter : Twinkle, twinkle, little bat! How I wonder what you're at.", @@ -218,7 +219,8 @@ public void testCompositeSearchHasChainOperatorsEquals() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where prop1.asInteger() = 1 and prop2 = 2")) + "select * from sqlSelectHashIndexReuseTestClass where prop1.asInteger() = 1 and" + + " prop2 = 2")) .execute(); Assert.assertEquals(result.size(), 1); @@ -301,7 +303,8 @@ public void testCompositeSearchEqualsOneFieldMapIndexByKey() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where fEmbeddedMapTwo containsKey 'key11'")) + "select * from sqlSelectHashIndexReuseTestClass where fEmbeddedMapTwo" + + " containsKey 'key11'")) .execute(); Assert.assertEquals(result.size(), 10); @@ -417,7 +420,8 @@ public void testCompositeSearchEqualsOneFieldMapIndexByValue() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where fEmbeddedMapTwo containsValue 22")) + "select * from sqlSelectHashIndexReuseTestClass where fEmbeddedMapTwo" + + " containsValue 22")) .execute(); final Map embeddedMap = new HashMap(); @@ -617,7 +621,8 @@ public void testCompositeSearchEqualsOneFieldEmbeddedListIndex() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where fEmbeddedListTwo contains 4")) + "select * from sqlSelectHashIndexReuseTestClass where fEmbeddedListTwo contains" + + " 4")) .execute(); Assert.assertEquals(result.size(), 10); @@ -974,7 +979,8 @@ public void testCompositeSearchGTQ() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where prop1 = 1 and prop2 >= 2")) + "select * from sqlSelectHashIndexReuseTestClass where prop1 = 1 and prop2 >=" + + " 2")) .execute(); Assert.assertEquals(result.size(), 8); @@ -1062,7 +1068,8 @@ public void testCompositeSearchGTQWithArgs() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where prop1 = ? and prop2 >= ?")) + "select * from sqlSelectHashIndexReuseTestClass where prop1 = ? and prop2 >=" + + " ?")) .execute(1, 2); Assert.assertEquals(result.size(), 8); @@ -1150,7 +1157,8 @@ public void testCompositeSearchLTQ() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where prop1 = 1 and prop2 <= 2")) + "select * from sqlSelectHashIndexReuseTestClass where prop1 = 1 and prop2 <=" + + " 2")) .execute(); Assert.assertEquals(result.size(), 3); @@ -1238,7 +1246,8 @@ public void testCompositeSearchLTQWithArgs() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where prop1 = ? and prop2 <= ?")) + "select * from sqlSelectHashIndexReuseTestClass where prop1 = ? and prop2 <=" + + " ?")) .execute(1, 2); Assert.assertEquals(result.size(), 3); @@ -1502,7 +1511,8 @@ public void testCompositeSearchBetween() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where prop1 = 1 and prop2 between 1 and 3")) + "select * from sqlSelectHashIndexReuseTestClass where prop1 = 1 and prop2" + + " between 1 and 3")) .execute(); Assert.assertEquals(result.size(), 3); @@ -1590,7 +1600,8 @@ public void testCompositeSearchBetweenWithArgs() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where prop1 = 1 and prop2 between ? and ?")) + "select * from sqlSelectHashIndexReuseTestClass where prop1 = 1 and prop2" + + " between ? and ?")) .execute(1, 3); Assert.assertEquals(result.size(), 3); @@ -2031,7 +2042,8 @@ public void testMostSpecificOnesProcessedFirst() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where (prop1 = 1 and prop2 = 1) and prop3 = 11")) + "select * from sqlSelectHashIndexReuseTestClass where (prop1 = 1 and prop2 = 1)" + + " and prop3 = 11")) .execute(); Assert.assertEquals(result.size(), 1); @@ -2058,7 +2070,8 @@ public void testTripleSearch() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where prop1 = 1 and prop2 = 1 and prop4 = 1")) + "select * from sqlSelectHashIndexReuseTestClass where prop1 = 1 and prop2 = 1" + + " and prop4 = 1")) .execute(); Assert.assertEquals(result.size(), 1); @@ -2085,7 +2098,8 @@ public void testTripleSearchLastFieldNotInIndexFirstCase() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where (prop1 = 1 and prop2 = 1) and prop5 >= 1")) + "select * from sqlSelectHashIndexReuseTestClass where (prop1 = 1 and prop2 = 1)" + + " and prop5 >= 1")) .execute(); Assert.assertEquals(result.size(), 1); @@ -2112,7 +2126,8 @@ public void testTripleSearchLastFieldNotInIndexSecondCase() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where prop1 = 1 and prop4 >= 1")) + "select * from sqlSelectHashIndexReuseTestClass where prop1 = 1 and prop4 >=" + + " 1")) .execute(); Assert.assertEquals(result.size(), 10); @@ -2190,7 +2205,8 @@ public void testTripleSearchLastFieldsCanNotBeMerged() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where prop6 <= 1 and prop4 < 1")) + "select * from sqlSelectHashIndexReuseTestClass where prop6 <= 1 and prop4 <" + + " 1")) .execute(); Assert.assertEquals(result.size(), 2); @@ -2228,7 +2244,8 @@ public void testLastFieldNotCompatibleOperator() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where prop1 = 1 and prop2 + 1 = 3")) + "select * from sqlSelectHashIndexReuseTestClass where prop1 = 1 and prop2 + 1 =" + + " 3")) .execute(); Assert.assertEquals(result.size(), 1); @@ -2253,7 +2270,8 @@ public void testEmbeddedMapByKeyIndexReuse() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where fEmbeddedMap containskey 'key12'")) + "select * from sqlSelectHashIndexReuseTestClass where fEmbeddedMap containskey" + + " 'key12'")) .execute(); Assert.assertEquals(result.size(), 10); @@ -2288,7 +2306,8 @@ public void testEmbeddedMapBySpecificKeyIndexReuse() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where ( fEmbeddedMap containskey 'key12' ) and ( fEmbeddedMap['key12'] = 12 )")) + "select * from sqlSelectHashIndexReuseTestClass where ( fEmbeddedMap" + + " containskey 'key12' ) and ( fEmbeddedMap['key12'] = 12 )")) .execute(); Assert.assertEquals(result.size(), 10); @@ -2323,7 +2342,8 @@ public void testEmbeddedMapByValueIndexReuse() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where fEmbeddedMap containsvalue 11")) + "select * from sqlSelectHashIndexReuseTestClass where fEmbeddedMap" + + " containsvalue 11")) .execute(); Assert.assertEquals(result.size(), 10); @@ -2358,7 +2378,8 @@ public void testEmbeddedListIndexReuse() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where fEmbeddedList contains 7")) + "select * from sqlSelectHashIndexReuseTestClass where fEmbeddedList contains" + + " 7")) .execute(); final List embeddedList = new ArrayList(3); @@ -2388,7 +2409,8 @@ public void testNotIndexOperatorFirstCase() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where (prop1 = 1 and prop2 = 2) and (prop4 = 3 or prop4 = 1)")) + "select * from sqlSelectHashIndexReuseTestClass where (prop1 = 1 and prop2 =" + + " 2) and (prop4 = 3 or prop4 = 1)")) .execute(); Assert.assertEquals(result.size(), 1); @@ -2413,7 +2435,8 @@ public void testNotIndexOperatorSecondCase() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where ( prop1 = 1 and prop2 = 2 ) or ( prop4 = 1 and prop6 = 2 )")) + "select * from sqlSelectHashIndexReuseTestClass where ( prop1 = 1 and prop2 = 2" + + " ) or ( prop4 = 1 and prop6 = 2 )")) .execute(); Assert.assertEquals(result.size(), 1); @@ -2437,7 +2460,8 @@ public void testCompositeIndexEmptyResult() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where prop1 = 1777 and prop2 = 2777")) + "select * from sqlSelectHashIndexReuseTestClass where prop1 = 1777 and prop2 =" + + " 2777")) .execute(); Assert.assertEquals(result.size(), 0); @@ -2481,7 +2505,8 @@ public void testReuseOfIndexOnSeveralClassesFields() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestChildClass where prop0 = 0 and prop1 = 1")) + "select * from sqlSelectHashIndexReuseTestChildClass where prop0 = 0 and prop1" + + " = 1")) .execute(); Assert.assertEquals(result.size(), 1); @@ -2517,7 +2542,8 @@ public void testCountFunctionWithNotUniqueIndex() { database .query( new OSQLSynchQuery( - "select count(*) from CountFunctionWithNotUniqueHashIndex where a = 'a' and b = 'b'")) + "select count(*) from CountFunctionWithNotUniqueHashIndex where a = 'a' and" + + " b = 'b'")) .get(0); Assert.assertEquals(result.field("count", Long.class), 1L); @@ -2574,7 +2600,8 @@ public void testCompositeSearchIn1() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where prop4 = 1 and prop1 = 1 and prop3 in [13, 113]")) + "select * from sqlSelectHashIndexReuseTestClass where prop4 = 1 and prop1 = 1" + + " and prop3 in [13, 113]")) .execute(); Assert.assertEquals(result.size(), 1); @@ -2604,7 +2631,8 @@ public void testCompositeSearchIn2() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where prop4 = 1 and prop1 in [1, 2] and prop3 = 13")) + "select * from sqlSelectHashIndexReuseTestClass where prop4 = 1 and prop1 in" + + " [1, 2] and prop3 = 13")) .execute(); Assert.assertEquals(result.size(), 1); @@ -2636,7 +2664,8 @@ public void testCompositeSearchIn3() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where prop4 = 1 and prop1 in [1, 2] and prop3 in [13, 15]")) + "select * from sqlSelectHashIndexReuseTestClass where prop4 = 1 and prop1 in" + + " [1, 2] and prop3 in [13, 15]")) .execute(); Assert.assertEquals(result.size(), 2); @@ -2669,7 +2698,8 @@ public void testCompositeSearchIn4() { database .command( new OSQLSynchQuery( - "select * from sqlSelectHashIndexReuseTestClass where prop4 in [1, 2] and prop1 = 1 and prop3 = 13")) + "select * from sqlSelectHashIndexReuseTestClass where prop4 in [1, 2] and prop1" + + " = 1 and prop3 = 13")) .execute(); Assert.assertEquals(result.size(), 1); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectIndexReuseTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectIndexReuseTest.java index 5d1aeeaf12a..315b53ab81c 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectIndexReuseTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectIndexReuseTest.java @@ -105,7 +105,8 @@ public void beforeClass() throws Exception { final String fullTextIndexStrings[] = { "Alice : What is the use of a book, without pictures or conversations?", "Rabbit : Oh my ears and whiskers, how late it's getting!", - "Alice : If it had grown up, it would have made a dreadfully ugly child; but it makes rather a handsome pig, I think", + "Alice : If it had grown up, it would have made a dreadfully ugly child; but it makes rather" + + " a handsome pig, I think", "The Cat : We're all mad here.", "The Hatter : Why is a raven like a writing desk?", "The Hatter : Twinkle, twinkle, little bat! How I wonder what you're at.", @@ -221,7 +222,8 @@ public void testCompositeSearchHasChainOperatorsEquals() { database .command( new OSQLSynchQuery( - "select * from sqlSelectIndexReuseTestClass where prop1.asInteger() = 1 and prop2 = 2")) + "select * from sqlSelectIndexReuseTestClass where prop1.asInteger() = 1 and" + + " prop2 = 2")) .execute(); Assert.assertEquals(result.size(), 1); @@ -304,7 +306,8 @@ public void testCompositeSearchEqualsOneFieldWithLimit() { database .command( new OSQLSynchQuery( - "select * from sqlSelectIndexReuseTestClass where prop1 = 1 and prop3 = 18 limit 1")) + "select * from sqlSelectIndexReuseTestClass where prop1 = 1 and prop3 = 18" + + " limit 1")) .execute(); Assert.assertEquals(result.size(), 1); @@ -350,7 +353,8 @@ public void testCompositeSearchEqualsOneFieldMapIndexByKey() { database .command( new OSQLSynchQuery( - "select * from sqlSelectIndexReuseTestClass where fEmbeddedMapTwo containsKey 'key11'")) + "select * from sqlSelectIndexReuseTestClass where fEmbeddedMapTwo containsKey" + + " 'key11'")) .execute(); Assert.assertEquals(result.size(), 10); @@ -1758,7 +1762,8 @@ public void testCompositeSearchBetween() { database .command( new OSQLSynchQuery( - "select * from sqlSelectIndexReuseTestClass where prop1 = 1 and prop2 between 1 and 3")) + "select * from sqlSelectIndexReuseTestClass where prop1 = 1 and prop2 between 1" + + " and 3")) .execute(); Assert.assertEquals(result.size(), 3); @@ -1866,7 +1871,8 @@ public void testCompositeSearchBetweenWithArgs() { database .command( new OSQLSynchQuery( - "select * from sqlSelectIndexReuseTestClass where prop1 = 1 and prop2 between ? and ?")) + "select * from sqlSelectIndexReuseTestClass where prop1 = 1 and prop2 between ?" + + " and ?")) .execute(1, 3); Assert.assertEquals(result.size(), 3); @@ -2372,7 +2378,8 @@ public void testMostSpecificOnesProcessedFirst() { database .command( new OSQLSynchQuery( - "select * from sqlSelectIndexReuseTestClass where prop1 = 1 and prop2 = 1 and prop3 = 11")) + "select * from sqlSelectIndexReuseTestClass where prop1 = 1 and prop2 = 1 and" + + " prop3 = 11")) .execute(); Assert.assertEquals(result.size(), 1); @@ -2409,7 +2416,8 @@ public void testTripleSearch() { database .command( new OSQLSynchQuery( - "select * from sqlSelectIndexReuseTestClass where prop1 = 1 and prop2 = 1 and prop4 >= 1")) + "select * from sqlSelectIndexReuseTestClass where prop1 = 1 and prop2 = 1 and" + + " prop4 >= 1")) .execute(); Assert.assertEquals(result.size(), 1); @@ -2446,7 +2454,8 @@ public void testTripleSearchLastFieldNotInIndexFirstCase() { database .command( new OSQLSynchQuery( - "select * from sqlSelectIndexReuseTestClass where prop1 = 1 and prop2 = 1 and prop5 >= 1")) + "select * from sqlSelectIndexReuseTestClass where prop1 = 1 and prop2 = 1 and" + + " prop5 >= 1")) .execute(); Assert.assertEquals(result.size(), 1); @@ -2634,7 +2643,8 @@ public void testEmbeddedMapByKeyIndexReuse() { database .command( new OSQLSynchQuery( - "select * from sqlSelectIndexReuseTestClass where fEmbeddedMap containskey 'key12'")) + "select * from sqlSelectIndexReuseTestClass where fEmbeddedMap containskey" + + " 'key12'")) .execute(); Assert.assertEquals(result.size(), 10); @@ -2673,7 +2683,8 @@ public void testEmbeddedMapBySpecificKeyIndexReuse() { database .command( new OSQLSynchQuery( - "select * from sqlSelectIndexReuseTestClass where ( fEmbeddedMap containskey 'key12' ) and ( fEmbeddedMap['key12'] = 12 )")) + "select * from sqlSelectIndexReuseTestClass where ( fEmbeddedMap containskey" + + " 'key12' ) and ( fEmbeddedMap['key12'] = 12 )")) .execute(); Assert.assertEquals(result.size(), 10); @@ -2712,7 +2723,8 @@ public void testEmbeddedMapByValueIndexReuse() { database .command( new OSQLSynchQuery( - "select * from sqlSelectIndexReuseTestClass where fEmbeddedMap containsvalue 11")) + "select * from sqlSelectIndexReuseTestClass where fEmbeddedMap containsvalue" + + " 11")) .execute(); Assert.assertEquals(result.size(), 10); @@ -2791,7 +2803,8 @@ public void testNotIndexOperatorFirstCase() { database .command( new OSQLSynchQuery( - "select * from sqlSelectIndexReuseTestClass where prop1 = 1 and prop2 = 2 and ( prop4 = 3 or prop4 = 1 )")) + "select * from sqlSelectIndexReuseTestClass where prop1 = 1 and prop2 = 2 and" + + " ( prop4 = 3 or prop4 = 1 )")) .execute(); Assert.assertEquals(result.size(), 1); @@ -2816,7 +2829,8 @@ public void testIndexUsedOnOrClause() { database .command( new OSQLSynchQuery( - "select * from sqlSelectIndexReuseTestClass where ( prop1 = 1 and prop2 = 2 ) or ( prop4 = 1 and prop6 = 2 )")) + "select * from sqlSelectIndexReuseTestClass where ( prop1 = 1 and prop2 = 2 )" + + " or ( prop4 = 1 and prop6 = 2 )")) .execute(); Assert.assertEquals(result.size(), 1); @@ -2850,7 +2864,8 @@ public void testCompositeIndexEmptyResult() { database .command( new OSQLSynchQuery( - "select * from sqlSelectIndexReuseTestClass where prop1 = 1777 and prop2 = 2777")) + "select * from sqlSelectIndexReuseTestClass where prop1 = 1777 and prop2 =" + + " 2777")) .execute(); Assert.assertEquals(result.size(), 0); @@ -2894,7 +2909,8 @@ public void testReuseOfIndexOnSeveralClassesFields() { database .command( new OSQLSynchQuery( - "select * from sqlSelectIndexReuseTestChildClass where prop0 = 0 and prop1 = 1")) + "select * from sqlSelectIndexReuseTestChildClass where prop0 = 0 and prop1 =" + + " 1")) .execute(); Assert.assertEquals(result.size(), 1); @@ -2944,7 +2960,8 @@ public void testCountFunctionWithNotUniqueIndex() { database .query( new OSQLSynchQuery( - "select count(*) from CountFunctionWithNotUniqueIndexTest where a = 'a' and b = 'c'")) + "select count(*) from CountFunctionWithNotUniqueIndexTest where a = 'a' and" + + " b = 'c'")) .get(0); Assert.assertEquals(result.field("count", Long.class), 0l); @@ -2993,7 +3010,8 @@ public void testCountFunctionWithUniqueIndex() { database .query( new OSQLSynchQuery( - "select count(*) from CountFunctionWithUniqueIndexTest where a = 'a' and b = 'c'")) + "select count(*) from CountFunctionWithUniqueIndexTest where a = 'a' and b" + + " = 'c'")) .get(0); Assert.assertEquals(result.field("count", Long.class), 2l); @@ -3045,7 +3063,8 @@ public void testCompositeSearchIn1() { database .command( new OSQLSynchQuery( - "select * from sqlSelectIndexReuseTestClass where prop4 = 1 and prop1 = 1 and prop3 in [13, 113]")) + "select * from sqlSelectIndexReuseTestClass where prop4 = 1 and prop1 = 1 and" + + " prop3 in [13, 113]")) .execute(); Assert.assertEquals(result.size(), 1); @@ -3088,7 +3107,8 @@ public void testCompositeSearchIn2() { database .command( new OSQLSynchQuery( - "select * from sqlSelectIndexReuseTestClass where prop4 = 1 and prop1 in [1, 2] and prop3 = 13")) + "select * from sqlSelectIndexReuseTestClass where prop4 = 1 and prop1 in [1, 2]" + + " and prop3 = 13")) .execute(); Assert.assertEquals(result.size(), 1); @@ -3131,7 +3151,8 @@ public void testCompositeSearchIn3() { database .command( new OSQLSynchQuery( - "select * from sqlSelectIndexReuseTestClass where prop4 = 1 and prop1 in [1, 2] and prop3 in [13, 15]")) + "select * from sqlSelectIndexReuseTestClass where prop4 = 1 and prop1 in [1, 2]" + + " and prop3 in [13, 15]")) .execute(); Assert.assertEquals(result.size(), 2); @@ -3175,7 +3196,8 @@ public void testCompositeSearchIn4() { database .command( new OSQLSynchQuery( - "select * from sqlSelectIndexReuseTestClass where prop4 in [1, 2] and prop1 = 1 and prop3 = 13")) + "select * from sqlSelectIndexReuseTestClass where prop4 in [1, 2] and prop1 = 1" + + " and prop3 = 13")) .execute(); Assert.assertEquals(result.size(), 1); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectProjectionsTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectProjectionsTest.java index 09cbf9c2a08..913f6529930 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectProjectionsTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectProjectionsTest.java @@ -47,7 +47,8 @@ public void queryProjectionOk() { database .command( new OSQLSynchQuery( - " select nick, followings, followers from Profile where nick is defined and followings is defined and followers is defined")) + " select nick, followings, followers from Profile where nick is defined and" + + " followings is defined and followers is defined")) .execute(); Assert.assertTrue(result.size() != 0); @@ -91,7 +92,8 @@ public void queryProjectionLinkedAndFunction() { database .command( new OSQLSynchQuery( - "select name.toUpperCase(Locale.ENGLISH), address.city.country.name from Profile")) + "select name.toUpperCase(Locale.ENGLISH), address.city.country.name from" + + " Profile")) .execute(); Assert.assertTrue(result.size() != 0); @@ -113,7 +115,8 @@ public void queryProjectionSameFieldTwice() { database .command( new OSQLSynchQuery( - "select name, name.toUpperCase(Locale.ENGLISH) from Profile where name is not null")) + "select name, name.toUpperCase(Locale.ENGLISH) from Profile where name is not" + + " null")) .execute(); Assert.assertTrue(result.size() != 0); @@ -134,7 +137,8 @@ public void queryProjectionStaticValues() { database .command( new OSQLSynchQuery( - "select location.city.country.name, address.city.country.name from Profile where location.city.country.name is not null")) + "select location.city.country.name, address.city.country.name from Profile" + + " where location.city.country.name is not null")) .execute(); Assert.assertTrue(result.size() != 0); @@ -155,7 +159,8 @@ public void queryProjectionPrefixAndAppend() { database .command( new OSQLSynchQuery( - "select *, name.prefix('Mr. ').append(' ').append(surname).append('!') as test from Profile where name is not null")) + "select *, name.prefix('Mr. ').append(' ').append(surname).append('!') as test" + + " from Profile where name is not null")) .execute(); Assert.assertTrue(result.size() != 0); @@ -174,7 +179,8 @@ public void queryProjectionFunctionsAndFieldOperators() { database .command( new OSQLSynchQuery( - "select name.append('.').prefix('Mr. ') as name from Profile where name is not null")) + "select name.append('.').prefix('Mr. ') as name from Profile where name is not" + + " null")) .execute(); Assert.assertTrue(result.size() != 0); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectTest.java index 14c93b2fad4..86d21c8a524 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectTest.java @@ -120,7 +120,8 @@ public void queryNoWhere() { public void queryParentesisAsRight() { List result = executeQuery( - " select from Profile where ( name = 'Giuseppe' and ( name <> 'Napoleone' and nick is not null )) ", + " select from Profile where ( name = 'Giuseppe' and ( name <> 'Napoleone' and nick is" + + " not null )) ", database); Assert.assertTrue(result.size() != 0); @@ -146,7 +147,8 @@ public void querySingleAndDoubleQuotes() { public void queryTwoParentesisConditions() { List result = executeQuery( - "select from Profile where ( name = 'Giuseppe' and nick is not null ) or ( name = 'Napoleone' and nick is not null ) ", + "select from Profile where ( name = 'Giuseppe' and nick is not null ) or ( name =" + + " 'Napoleone' and nick is not null ) ", database); Assert.assertTrue(result.size() != 0); @@ -339,7 +341,8 @@ public void queryContainsInEmbeddedMapClassic() { resultset = executeQuery( - "select customReferences['second', 'first'] from Profile where customReferences.size() = 2", + "select customReferences['second', 'first'] from Profile where customReferences.size()" + + " = 2", database); Assert.assertEquals(resultset.size(), 1); @@ -359,13 +362,15 @@ public void queryContainsInEmbeddedMapClassic() { resultset = executeQuery( - "select customReferences[second]['name'] from Profile where customReferences[second]['name'] is not null", + "select customReferences[second]['name'] from Profile where" + + " customReferences[second]['name'] is not null", database); Assert.assertEquals(resultset.size(), 1); resultset = executeQuery( - "select customReferences[second]['name'] as value from Profile where customReferences[second]['name'] is not null", + "select customReferences[second]['name'] as value from Profile where" + + " customReferences[second]['name'] is not null", database); Assert.assertEquals(resultset.size(), 1); @@ -405,7 +410,8 @@ public void queryContainsInEmbeddedMapNew() { public void queryCollectionContainsLowerCaseSubStringIgnoreCase() { List result = executeQuery( - "select * from cluster:profile where races contains (name.toLowerCase(Locale.ENGLISH).subString(0,1) = 'e')", + "select * from cluster:profile where races contains" + + " (name.toLowerCase(Locale.ENGLISH).subString(0,1) = 'e')", database); for (int i = 0; i < result.size(); ++i) { @@ -1342,7 +1348,8 @@ public void testQueryNotOperator() { public void testSquareBracketsOnCondition() { List result = executeQuery( - "select from Account where addresses[@class='Address'][city.country.name] = 'Washington'", + "select from Account where addresses[@class='Address'][city.country.name] =" + + " 'Washington'", database); Assert.assertFalse(result.isEmpty()); for (ODocument d : result) { @@ -1395,7 +1402,8 @@ public void queryInstanceOfOperator() { public void subQuery() { List result = executeQuery( - "select from Account where name in ( select name from Account where name is not null limit 1 )", + "select from Account where name in ( select name from Account where name is not null" + + " limit 1 )", database); Assert.assertTrue(result.size() != 0); @@ -1405,7 +1413,8 @@ public void subQuery() { public void subQueryNoFrom() { List result2 = executeQuery( - "select $names let $names = (select EXPAND( addresses.city ) as city from Account where addresses.size() > 0 )", + "select $names let $names = (select EXPAND( addresses.city ) as city from Account where" + + " addresses.size() > 0 )", database); Assert.assertTrue(result2.size() != 0); @@ -1609,7 +1618,8 @@ public void testMapKeys() { public void queryAsynch() { final String sqlOne = "select * from company where id between 4 and 7"; final String sqlTwo = - "select $names let $names = (select EXPAND( addresses.city ) as city from Account where addresses.size() > 0 )"; + "select $names let $names = (select EXPAND( addresses.city ) as city from Account where" + + " addresses.size() > 0 )"; final List synchResultOne = database.command(new OSQLSynchQuery(sqlOne)).execute(); @@ -1687,7 +1697,8 @@ public Object getResult() { public void queryAsynchHalfForheFirstQuery() { final String sqlOne = "select * from company where id between 4 and 7"; final String sqlTwo = - "select $names let $names = (select EXPAND( addresses.city ) as city from Account where addresses.size() > 0 )"; + "select $names let $names = (select EXPAND( addresses.city ) as city from Account where" + + " addresses.size() > 0 )"; final List synchResultOne = database.command(new OSQLSynchQuery(sqlOne)).execute(); @@ -1791,12 +1802,14 @@ public void testSelectFromIndexValues() { (List) database.query( new OSQLSynchQuery( - "select from Profile where ((nick like 'J%') or (nick like 'N%')) and (name is not null)"))); + "select from Profile where ((nick like 'J%') or (nick like 'N%')) and (name" + + " is not null)"))); final List indexValuesResult = database.query( new OSQLSynchQuery( - "select from indexvalues:selectFromIndexValues where ((nick like 'J%') or (nick like 'N%')) and (name is not null)")); + "select from indexvalues:selectFromIndexValues where ((nick like 'J%') or (nick" + + " like 'N%')) and (name is not null)")); Assert.assertEquals(indexValuesResult.size(), classResult.size()); @@ -1822,12 +1835,14 @@ public void testSelectFromIndexValuesAsc() { (List) database.query( new OSQLSynchQuery( - "select from Profile where ((nick like 'J%') or (nick like 'N%')) and (name is not null)"))); + "select from Profile where ((nick like 'J%') or (nick like 'N%')) and (name" + + " is not null)"))); final List indexValuesResult = database.query( new OSQLSynchQuery( - "select from indexvaluesasc:selectFromIndexValuesAsc where ((nick like 'J%') or (nick like 'N%')) and (name is not null)")); + "select from indexvaluesasc:selectFromIndexValuesAsc where ((nick like 'J%') or" + + " (nick like 'N%')) and (name is not null)")); Assert.assertEquals(indexValuesResult.size(), classResult.size()); @@ -1853,12 +1868,14 @@ public void testSelectFromIndexValuesDesc() { (List) database.query( new OSQLSynchQuery( - "select from Profile where ((nick like 'J%') or (nick like 'N%')) and (name is not null)"))); + "select from Profile where ((nick like 'J%') or (nick like 'N%')) and (name" + + " is not null)"))); final List indexValuesResult = database.query( new OSQLSynchQuery( - "select from indexvaluesdesc:selectFromIndexValuesDesc where ((nick like 'J%') or (nick like 'N%')) and (name is not null)")); + "select from indexvaluesdesc:selectFromIndexValuesDesc where ((nick like 'J%') or" + + " (nick like 'N%')) and (name is not null)")); Assert.assertEquals(indexValuesResult.size(), classResult.size()); @@ -1887,7 +1904,8 @@ public void testQueryLetExecutedOnce() { final List result = database.query( new OSQLSynchQuery( - "select name, $counter as counter from OUser let $counter = eval(\"$counter + 1\")")); + "select name, $counter as counter from OUser let $counter = eval(\"$counter +" + + " 1\")")); Assert.assertFalse(result.isEmpty()); int i = 1; @@ -1944,13 +1962,16 @@ public void testOutFilterInclude() { database.command("insert into TestOutFilterInclude content { \"name\": \"two\" }").close(); database .command( - "create edge linkedToOutFilterInclude from (select from TestOutFilterInclude where name = 'one') to (select from TestOutFilterInclude where name = 'two')") + "create edge linkedToOutFilterInclude from (select from TestOutFilterInclude where name" + + " = 'one') to (select from TestOutFilterInclude where name = 'two')") .close(); final List result = database.query( new OSQLSynchQuery( - "select expand(out('linkedToOutFilterInclude')[@class='TestOutFilterInclude'].include('@rid')) from TestOutFilterInclude where name = 'one'")); + "select" + + " expand(out('linkedToOutFilterInclude')[@class='TestOutFilterInclude'].include('@rid'))" + + " from TestOutFilterInclude where name = 'one'")); Assert.assertEquals(result.size(), 1); @@ -2006,7 +2027,8 @@ public void testExpandSkip() { database .command( - "CREATE EDGE E FROM (SELECT FROM TestExpandSkip WHERE name = '1') to (SELECT FROM TestExpandSkip WHERE name <> '1')") + "CREATE EDGE E FROM (SELECT FROM TestExpandSkip WHERE name = '1') to (SELECT FROM" + + " TestExpandSkip WHERE name <> '1')") .close(); OResultSet result = database.query("select expand(out()) from TestExpandSkip where name = '1'"); @@ -2050,21 +2072,25 @@ public void testPolymorphicEdges() { database .command( - "CREATE EDGE TestPolymorphicEdges_E1 FROM (SELECT FROM TestPolymorphicEdges_V WHERE name = '1') to (SELECT FROM TestPolymorphicEdges_V WHERE name = '2')") + "CREATE EDGE TestPolymorphicEdges_E1 FROM (SELECT FROM TestPolymorphicEdges_V WHERE" + + " name = '1') to (SELECT FROM TestPolymorphicEdges_V WHERE name = '2')") .close(); database .command( - "CREATE EDGE TestPolymorphicEdges_E2 FROM (SELECT FROM TestPolymorphicEdges_V WHERE name = '1') to (SELECT FROM TestPolymorphicEdges_V WHERE name = '3')") + "CREATE EDGE TestPolymorphicEdges_E2 FROM (SELECT FROM TestPolymorphicEdges_V WHERE" + + " name = '1') to (SELECT FROM TestPolymorphicEdges_V WHERE name = '3')") .close(); OResultSet result = database.query( - "select expand(out('TestPolymorphicEdges_E1')) from TestPolymorphicEdges_V where name = '1'"); + "select expand(out('TestPolymorphicEdges_E1')) from TestPolymorphicEdges_V where name =" + + " '1'"); Assert.assertEquals(result.stream().count(), 2); result = database.query( - "select expand(out('TestPolymorphicEdges_E2')) from TestPolymorphicEdges_V where name = '1' "); + "select expand(out('TestPolymorphicEdges_E2')) from TestPolymorphicEdges_V where name =" + + " '1' "); Assert.assertEquals(result.stream().count(), 1); } @@ -2078,12 +2104,14 @@ public void testSizeOfLink() { database.command("CREATE VERTEX TestSizeOfLink set name = '3'").close(); database .command( - "CREATE EDGE E FROM (SELECT FROM TestSizeOfLink WHERE name = '1') to (SELECT FROM TestSizeOfLink WHERE name <> '1')") + "CREATE EDGE E FROM (SELECT FROM TestSizeOfLink WHERE name = '1') to (SELECT FROM" + + " TestSizeOfLink WHERE name <> '1')") .close(); OResultSet result = database.query( - " select from (select from TestSizeOfLink where name = '1') where out()[name=2].size() > 0"); + " select from (select from TestSizeOfLink where name = '1') where out()[name=2].size()" + + " > 0"); Assert.assertEquals(result.stream().count(), 1); } @@ -2095,17 +2123,20 @@ public void testEmbeddedMapAndDotNotation() { database.command("CREATE VERTEX EmbeddedMapAndDotNotation set name = 'foo'").close(); database .command( - "CREATE VERTEX EmbeddedMapAndDotNotation set data = {\"bar\": \"baz\", \"quux\": 1}, name = 'bar'") + "CREATE VERTEX EmbeddedMapAndDotNotation set data = {\"bar\": \"baz\", \"quux\": 1}," + + " name = 'bar'") .close(); database .command( - "CREATE EDGE E FROM (SELECT FROM EmbeddedMapAndDotNotation WHERE name = 'foo') to (SELECT FROM EmbeddedMapAndDotNotation WHERE name = 'bar')") + "CREATE EDGE E FROM (SELECT FROM EmbeddedMapAndDotNotation WHERE name = 'foo') to" + + " (SELECT FROM EmbeddedMapAndDotNotation WHERE name = 'bar')") .close(); List result = database.query( new OSQLSynchQuery( - " select out().data as result from (select from EmbeddedMapAndDotNotation where name = 'foo')")); + " select out().data as result from (select from EmbeddedMapAndDotNotation where" + + " name = 'foo')")); Assert.assertEquals(result.size(), 1); ODocument doc = result.get(0).getRecord(); Assert.assertNotNull(doc); @@ -2125,7 +2156,8 @@ public void testLetWithQuotedValue() { OResultSet result = database.query( - " select expand($a) let $a = (select from LetWithQuotedValue where name = \"\\\"foo\\\"\")"); + " select expand($a) let $a = (select from LetWithQuotedValue where name =" + + " \"\\\"foo\\\"\")"); Assert.assertEquals(result.stream().count(), 1); } @@ -2141,7 +2173,8 @@ public void testNamedParams() { database.command("insert into testNamedParams set login = 20").close(); database .command( - "CREATE EDGE testNamedParams_HasPermission from (select from testNamedParams) to (select from testNamedParams_permission)") + "CREATE EDGE testNamedParams_HasPermission from (select from testNamedParams) to" + + " (select from testNamedParams_permission)") .close(); Map params = new HashMap(); @@ -2151,7 +2184,10 @@ public void testNamedParams() { List results = database.query( new OSQLSynchQuery( - "SELECT *, out('testNamedParams_HasPermission').type as permissions FROM testNamedParams WHERE login >= :key AND out('testNamedParams_HasPermission').type IN :permissions ORDER BY login ASC LIMIT :limit"), + "SELECT *, out('testNamedParams_HasPermission').type as permissions FROM" + + " testNamedParams WHERE login >= :key AND" + + " out('testNamedParams_HasPermission').type IN :permissions ORDER BY login" + + " ASC LIMIT :limit"), params); Assert.assertEquals(results.size(), 1); } diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectTestNew.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectTestNew.java index e121d724077..316352bc876 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectTestNew.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectTestNew.java @@ -123,7 +123,8 @@ public void queryNoWhere() { public void queryParentesisAsRight() { List result = executeQuery( - " select from Profile where ( name = 'Giuseppe' and ( name <> 'Napoleone' and nick is not null )) ", + " select from Profile where ( name = 'Giuseppe' and ( name <> 'Napoleone' and nick is" + + " not null )) ", database); Assert.assertTrue(result.size() != 0); @@ -149,7 +150,8 @@ public void querySingleAndDoubleQuotes() { public void queryTwoParentesisConditions() { List result = executeQuery( - "select from Profile where ( name = 'Giuseppe' and nick is not null ) or ( name = 'Napoleone' and nick is not null ) ", + "select from Profile where ( name = 'Giuseppe' and nick is not null ) or ( name =" + + " 'Napoleone' and nick is not null ) ", database); Assert.assertTrue(result.size() != 0); @@ -342,7 +344,8 @@ public void queryContainsInEmbeddedMapClassic() { resultset = executeQuery( - "select customReferences['second', 'first'] as customReferences from Profile where customReferences.size() = 2", + "select customReferences['second', 'first'] as customReferences from Profile where" + + " customReferences.size() = 2", database); Assert.assertEquals(resultset.size(), 1); @@ -362,13 +365,15 @@ public void queryContainsInEmbeddedMapClassic() { resultset = executeQuery( - "select customReferences['second']['name'] from Profile where customReferences['second']['name'] is not null", + "select customReferences['second']['name'] from Profile where" + + " customReferences['second']['name'] is not null", database); Assert.assertEquals(resultset.size(), 1); resultset = executeQuery( - "select customReferences['second']['name'] as value from Profile where customReferences['second']['name'] is not null", + "select customReferences['second']['name'] as value from Profile where" + + " customReferences['second']['name'] is not null", database); Assert.assertEquals(resultset.size(), 1); @@ -408,7 +413,8 @@ public void queryContainsInEmbeddedMapNew() { public void queryCollectionContainsLowerCaseSubStringIgnoreCase() { List result = executeQuery( - "select * from cluster:profile where races contains (name.toLowerCase(Locale.ENGLISH).subString(0,1) = 'e')", + "select * from cluster:profile where races contains" + + " (name.toLowerCase(Locale.ENGLISH).subString(0,1) = 'e')", database); for (int i = 0; i < result.size(); ++i) { @@ -1277,7 +1283,8 @@ public void testQueryNotOperator() { public void testSquareBracketsOnCondition() { List result = executeQuery( - "select from Account where addresses[@class='Address'][city.country.name] = 'Washington'", + "select from Account where addresses[@class='Address'][city.country.name] =" + + " 'Washington'", database); Assert.assertFalse(result.isEmpty()); for (ODocument d : result) { @@ -1330,7 +1337,8 @@ public void queryInstanceOfOperator() { public void subQuery() { List result = executeQuery( - "select from Account where name in ( select name from Account where name is not null limit 1 )", + "select from Account where name in ( select name from Account where name is not null" + + " limit 1 )", database); Assert.assertTrue(result.size() != 0); @@ -1340,7 +1348,8 @@ public void subQuery() { public void subQueryNoFrom() { List result2 = executeQuery( - "select $names let $names = (select EXPAND( addresses.city ) as city from Account where addresses.size() > 0 )", + "select $names let $names = (select EXPAND( addresses.city ) as city from Account where" + + " addresses.size() > 0 )", database); Assert.assertTrue(result2.size() != 0); @@ -1544,7 +1553,8 @@ public void testMapKeys() { public void queryAsynch() { final String sqlOne = "select * from company where id between 4 and 7"; final String sqlTwo = - "select $names let $names = (select EXPAND( addresses.city ) as city from Account where addresses.size() > 0 )"; + "select $names let $names = (select EXPAND( addresses.city ) as city from Account where" + + " addresses.size() > 0 )"; final List synchResultOne = database.command(new OSQLSynchQuery(sqlOne)).execute(); @@ -1622,7 +1632,8 @@ public Object getResult() { public void queryAsynchHalfForheFirstQuery() { final String sqlOne = "select * from company where id between 4 and 7"; final String sqlTwo = - "select $names let $names = (select EXPAND( addresses.city ) as city from Account where addresses.size() > 0 )"; + "select $names let $names = (select EXPAND( addresses.city ) as city from Account where" + + " addresses.size() > 0 )"; final List synchResultOne = database.command(new OSQLSynchQuery(sqlOne)).execute(); @@ -1726,12 +1737,14 @@ public void testSelectFromIndexValues() { (List) database.query( new OSQLSynchQuery( - "select from Profile where ((nick like 'J%') or (nick like 'N%')) and (name is not null)"))); + "select from Profile where ((nick like 'J%') or (nick like 'N%')) and (name" + + " is not null)"))); final List indexValuesResult = database.query( new OSQLSynchQuery( - "select from indexvalues:selectFromIndexValues where ((nick like 'J%') or (nick like 'N%')) and (name is not null)")); + "select from indexvalues:selectFromIndexValues where ((nick like 'J%') or (nick" + + " like 'N%')) and (name is not null)")); Assert.assertEquals(indexValuesResult.size(), classResult.size()); @@ -1757,12 +1770,14 @@ public void testSelectFromIndexValuesAsc() { (List) database.query( new OSQLSynchQuery( - "select from Profile where ((nick like 'J%') or (nick like 'N%')) and (name is not null)"))); + "select from Profile where ((nick like 'J%') or (nick like 'N%')) and (name" + + " is not null)"))); final List indexValuesResult = database.query( new OSQLSynchQuery( - "select from indexvaluesasc:selectFromIndexValuesAsc where ((nick like 'J%') or (nick like 'N%')) and (name is not null)")); + "select from indexvaluesasc:selectFromIndexValuesAsc where ((nick like 'J%') or" + + " (nick like 'N%')) and (name is not null)")); Assert.assertEquals(indexValuesResult.size(), classResult.size()); @@ -1788,12 +1803,14 @@ public void testSelectFromIndexValuesDesc() { (List) database.query( new OSQLSynchQuery( - "select from Profile where ((nick like 'J%') or (nick like 'N%')) and (name is not null)"))); + "select from Profile where ((nick like 'J%') or (nick like 'N%')) and (name" + + " is not null)"))); final List indexValuesResult = database.query( new OSQLSynchQuery( - "select from indexvaluesdesc:selectFromIndexValuesDesc where ((nick like 'J%') or (nick like 'N%')) and (name is not null)")); + "select from indexvaluesdesc:selectFromIndexValuesDesc where ((nick like 'J%') or" + + " (nick like 'N%')) and (name is not null)")); Assert.assertEquals(indexValuesResult.size(), classResult.size()); @@ -1822,7 +1839,8 @@ public void testQueryLetExecutedOnce() { final List result = database.query( new OSQLSynchQuery( - "select name, $counter as counter from OUser let $counter = eval(\"$counter + 1\")")); + "select name, $counter as counter from OUser let $counter = eval(\"$counter +" + + " 1\")")); Assert.assertFalse(result.isEmpty()); int i = 1; @@ -1879,13 +1897,16 @@ public void testOutFilterInclude() { database.command("insert into TestOutFilterInclude content { \"name\": \"two\" }").close(); database .command( - "create edge linkedToOutFilterInclude from (select from TestOutFilterInclude where name = 'one') to (select from TestOutFilterInclude where name = 'two')") + "create edge linkedToOutFilterInclude from (select from TestOutFilterInclude where name" + + " = 'one') to (select from TestOutFilterInclude where name = 'two')") .close(); final List result = database.query( new OSQLSynchQuery( - "select expand(out('linkedToOutFilterInclude')[@class='TestOutFilterInclude'].include('@rid')) from TestOutFilterInclude where name = 'one'")); + "select" + + " expand(out('linkedToOutFilterInclude')[@class='TestOutFilterInclude'].include('@rid'))" + + " from TestOutFilterInclude where name = 'one'")); Assert.assertEquals(result.size(), 1); @@ -1942,7 +1963,8 @@ public void testExpandSkip() { database .command( - "CREATE EDGE E FROM (SELECT FROM TestExpandSkip WHERE name = '1') to (SELECT FROM TestExpandSkip WHERE name <> '1')") + "CREATE EDGE E FROM (SELECT FROM TestExpandSkip WHERE name = '1') to (SELECT FROM" + + " TestExpandSkip WHERE name <> '1')") .close(); List result = @@ -1982,7 +2004,8 @@ public void testExpandSkip() { Assert.assertEquals(result.size(), 0); result = - database.query("select expand(out()) from TestExpandSkip where name = '1' skip 1 limit 1") + database + .query("select expand(out()) from TestExpandSkip where name = '1' skip 1 limit 1") .stream() .map((e) -> e.toElement()) .collect(Collectors.toList()); @@ -2004,17 +2027,20 @@ public void testPolymorphicEdges() { database .command( - "CREATE EDGE TestPolymorphicEdges_E1 FROM (SELECT FROM TestPolymorphicEdges_V WHERE name = '1') to (SELECT FROM TestPolymorphicEdges_V WHERE name = '2')") + "CREATE EDGE TestPolymorphicEdges_E1 FROM (SELECT FROM TestPolymorphicEdges_V WHERE" + + " name = '1') to (SELECT FROM TestPolymorphicEdges_V WHERE name = '2')") .close(); database .command( - "CREATE EDGE TestPolymorphicEdges_E2 FROM (SELECT FROM TestPolymorphicEdges_V WHERE name = '1') to (SELECT FROM TestPolymorphicEdges_V WHERE name = '3')") + "CREATE EDGE TestPolymorphicEdges_E2 FROM (SELECT FROM TestPolymorphicEdges_V WHERE" + + " name = '1') to (SELECT FROM TestPolymorphicEdges_V WHERE name = '3')") .close(); List result = database .query( - "select expand(out('TestPolymorphicEdges_E1')) from TestPolymorphicEdges_V where name = '1'") + "select expand(out('TestPolymorphicEdges_E1')) from TestPolymorphicEdges_V where" + + " name = '1'") .stream() .map((r) -> r.toElement()) .collect(Collectors.toList()); @@ -2023,7 +2049,8 @@ public void testPolymorphicEdges() { result = database .query( - "select expand(out('TestPolymorphicEdges_E2')) from TestPolymorphicEdges_V where name = '1' ") + "select expand(out('TestPolymorphicEdges_E2')) from TestPolymorphicEdges_V where" + + " name = '1' ") .stream() .map((r) -> r.toElement()) .collect(Collectors.toList()); @@ -2040,13 +2067,15 @@ public void testSizeOfLink() { database.command("CREATE VERTEX TestSizeOfLink set name = '3'").close(); database .command( - "CREATE EDGE E FROM (SELECT FROM TestSizeOfLink WHERE name = '1') to (SELECT FROM TestSizeOfLink WHERE name <> '1')") + "CREATE EDGE E FROM (SELECT FROM TestSizeOfLink WHERE name = '1') to (SELECT FROM" + + " TestSizeOfLink WHERE name <> '1')") .close(); List result = database .query( - " select from (select from TestSizeOfLink where name = '1') where out()[name=2].size() > 0") + " select from (select from TestSizeOfLink where name = '1') where" + + " out()[name=2].size() > 0") .stream() .map((e) -> e.toElement()) .collect(Collectors.toList()); @@ -2062,17 +2091,20 @@ public void testEmbeddedMapAndDotNotation() { database .command( new OCommandSQL( - "CREATE VERTEX EmbeddedMapAndDotNotation set data = {\"bar\": \"baz\", \"quux\": 1}, name = 'bar'")) + "CREATE VERTEX EmbeddedMapAndDotNotation set data = {\"bar\": \"baz\", \"quux\":" + + " 1}, name = 'bar'")) .execute(); database .command( - "CREATE EDGE E FROM (SELECT FROM EmbeddedMapAndDotNotation WHERE name = 'foo') to (SELECT FROM EmbeddedMapAndDotNotation WHERE name = 'bar')") + "CREATE EDGE E FROM (SELECT FROM EmbeddedMapAndDotNotation WHERE name = 'foo') to" + + " (SELECT FROM EmbeddedMapAndDotNotation WHERE name = 'bar')") .close(); List result = database.query( new OSQLSynchQuery( - " select out().data as result from (select from EmbeddedMapAndDotNotation where name = 'foo')")); + " select out().data as result from (select from EmbeddedMapAndDotNotation where" + + " name = 'foo')")); Assert.assertEquals(result.size(), 1); ODocument doc = result.get(0).getRecord(); Assert.assertNotNull(doc); @@ -2093,7 +2125,8 @@ public void testLetWithQuotedValue() { List result = database.query( new OSQLSynchQuery( - " select expand($a) let $a = (select from LetWithQuotedValue where name = \"\\\"foo\\\"\")")); + " select expand($a) let $a = (select from LetWithQuotedValue where name =" + + " \"\\\"foo\\\"\")")); Assert.assertEquals(result.size(), 1); } diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLUpdateTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLUpdateTest.java index d966b4e36a2..bbbbdddcd53 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLUpdateTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLUpdateTest.java @@ -188,7 +188,8 @@ public void updateMapsWithSetOperator() { database .command( new OCommandSQL( - "insert into cluster:default (equaledges, name, properties) values ('no', 'circleUpdate', {'round':'eeee', 'blaaa':'zigzag'} )")) + "insert into cluster:default (equaledges, name, properties) values ('no'," + + " 'circleUpdate', {'round':'eeee', 'blaaa':'zigzag'} )")) .execute(); Integer records = @@ -197,7 +198,8 @@ public void updateMapsWithSetOperator() { new OCommandSQL( "update " + doc.getIdentity() - + " set properties = {'roundOne':'ffff', 'bla':'zagzig','testTestTEST':'okOkOK'}")) + + " set properties = {'roundOne':'ffff'," + + " 'bla':'zagzig','testTestTEST':'okOkOK'}")) .execute(); Assert.assertEquals(records.intValue(), 1); @@ -225,7 +227,8 @@ public void updateMapsWithPutOperatorAndWhere() { database .command( new OCommandSQL( - "insert into cluster:default (equaledges, name, properties) values ('no', 'updateMapsWithPutOperatorAndWhere', {} )")) + "insert into cluster:default (equaledges, name, properties) values ('no'," + + " 'updateMapsWithPutOperatorAndWhere', {} )")) .execute(); Integer records = @@ -234,7 +237,8 @@ public void updateMapsWithPutOperatorAndWhere() { new OCommandSQL( "update " + doc.getIdentity() - + " put properties = 'one', 'two' where name = 'updateMapsWithPutOperatorAndWhere'")) + + " put properties = 'one', 'two' where name =" + + " 'updateMapsWithPutOperatorAndWhere'")) .execute(); Assert.assertEquals(records.intValue(), 1); @@ -333,7 +337,8 @@ public void updateWithReturn() { sqlString = "UPDATE " + doc.getIdentity().toString() - + " INCREMENT Age = 100 RETURN AFTER $current.Exclude('really_big_field') WHERE Age=101 LIMIT 1"; + + " INCREMENT Age = 100 RETURN AFTER $current.Exclude('really_big_field') WHERE Age=101" + + " LIMIT 1"; result1 = database.command(new OCommandSQL(sqlString)).execute(); Assert.assertEquals(result1.size(), 1); Assert.assertTrue(result1.get(0).containsField("Age")); @@ -477,7 +482,8 @@ public void testEscaping() { database .command( - "UPDATE FormatEscapingTest SET test = 'ccc \\' eee', test2 = format('aaa \\' bbb') WHERE @rid = " + "UPDATE FormatEscapingTest SET test = 'ccc \\' eee', test2 = format('aaa \\' bbb')" + + " WHERE @rid = " + document.getIdentity()) .close(); @@ -548,7 +554,8 @@ public void testUpdateVertexContent() { database.command("create edge from " + vOneId + " to " + vTwoId).close(); List result = - database.query("select sum(outE().size(), inE().size()) as sum from UpdateVertexContent") + database + .query("select sum(outE().size(), inE().size()) as sum from UpdateVertexContent") .stream() .collect(Collectors.toList()); @@ -566,7 +573,8 @@ public void testUpdateVertexContent() { .close(); result = - database.query("select sum(outE().size(), inE().size()) as sum from UpdateVertexContent") + database + .query("select sum(outE().size(), inE().size()) as sum from UpdateVertexContent") .stream() .collect(Collectors.toList()); @@ -686,7 +694,8 @@ public void testAutoConversionOfEmbeddededListWithLinkedClass() { ORID id = database .command( - "INSERT INTO TestConvert SET name = 'embeddedListWithLinkedClass', embeddedListWithLinkedClass = [{'line1':'123 Fake Street'}]") + "INSERT INTO TestConvert SET name = 'embeddedListWithLinkedClass'," + + " embeddedListWithLinkedClass = [{'line1':'123 Fake Street'}]") .next() .getIdentity() .get(); @@ -695,7 +704,8 @@ public void testAutoConversionOfEmbeddededListWithLinkedClass() { .command( "UPDATE " + id.getIdentity() - + " set embeddedListWithLinkedClass = embeddedListWithLinkedClass || [{'line1':'123 Fake Street'}]") + + " set embeddedListWithLinkedClass = embeddedListWithLinkedClass || [{'line1':'123" + + " Fake Street'}]") .close(); OElement doc = database.reload(database.load(id), "", true); @@ -707,7 +717,8 @@ public void testAutoConversionOfEmbeddededListWithLinkedClass() { .command( "UPDATE " + doc.getIdentity() - + " set embeddedListWithLinkedClass = embeddedListWithLinkedClass || [{'line1':'123 Fake Street'}]") + + " set embeddedListWithLinkedClass = embeddedListWithLinkedClass ||" + + " [{'line1':'123 Fake Street'}]") .close(); doc.reload(); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SchemaIndexTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SchemaIndexTest.java index 6f56d9da6c7..fa8d407c346 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SchemaIndexTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SchemaIndexTest.java @@ -84,7 +84,8 @@ public void testDropSuperClass() throws Exception { Assert.assertTrue( e.getMessage() .startsWith( - "Class 'SchemaSharedIndexSuperTest' cannot be dropped because it has sub classes")); + "Class 'SchemaSharedIndexSuperTest' cannot be dropped because it has sub" + + " classes")); } database.getMetadata().getSchema().reload(); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SchemaTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SchemaTest.java index e32b02b73fd..37f37c11d89 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SchemaTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SchemaTest.java @@ -540,7 +540,8 @@ public void testOfflineCluster() { database .command( new OCommandSQL( - "insert into TestOffline set name = 'offline', password = 'offline', status = 'ACTIVE'")) + "insert into TestOffline set name = 'offline', password = 'offline', status =" + + " 'ACTIVE'")) .execute(); Assert.assertTrue(false); } catch (OException e) { diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/StringsTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/StringsTest.java index 1e7d072a23f..dfeab821408 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/StringsTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/StringsTest.java @@ -65,7 +65,8 @@ public void replaceAll() { "test \\string\\ 'number' \\2\\ \\\\ '''' test String number 2 test string number 2"); Assert.assertEquals( OStringParser.replaceAll(test2, "\\\\", "replacement"), - "test \\string\\ \"number\" \\2\\ replacement \"\"\"\" test String number 2 test string number 2"); + "test \\string\\ \"number\" \\2\\ replacement \"\"\"\" test String number 2 test string" + + " number 2"); String subsequentReplaceTest = OStringParser.replaceAll(test2, "\\", ""); subsequentReplaceTest = OStringParser.replaceAll(subsequentReplaceTest, "\"", ""); subsequentReplaceTest = diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/TraverseStrategiesTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/TraverseStrategiesTest.java index 6d80696dba4..ac48196adca 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/TraverseStrategiesTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/TraverseStrategiesTest.java @@ -23,7 +23,9 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -/** @author marko */ +/** + * @author marko + */ @Test public class TraverseStrategiesTest extends DocumentDBBaseTest { @@ -83,7 +85,8 @@ public void init() { public void getAllRevresedBreadthFirst() { OResultSet result1 = database.query( - "traverse in(\"te\") from (select rids from (select @rid as rids, out(\"te\") as outEdge from tc unwind outEdge) where outEdge is null) strategy BREADTH_FIRST"); + "traverse in(\"te\") from (select rids from (select @rid as rids, out(\"te\") as" + + " outEdge from tc unwind outEdge) where outEdge is null) strategy BREADTH_FIRST"); for (int i = 0; i < totalElements; i++) { Assert.assertTrue(result1.hasNext()); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/TraverseTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/TraverseTest.java index b22f66b143a..f23caf100f5 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/TraverseTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/TraverseTest.java @@ -357,7 +357,8 @@ public void traverseSelectNoInfluence() { database .command( new OSQLSynchQuery( - "select from ( traverse any() from Movie while $depth < 2 and ( true = true ) ) where true")) + "select from ( traverse any() from Movie while $depth < 2 and ( true = true ) )" + + " where true")) .execute(); Assert.assertEquals(result1, result2); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/TraverseTestNew.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/TraverseTestNew.java index 2520576d15b..7a88341cb23 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/TraverseTestNew.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/TraverseTestNew.java @@ -288,7 +288,8 @@ public void traverseSelectNoInfluence() { result3.close(); OResultSet result4 = database.query( - "select from ( traverse * from Movie while $depth < 2 and ( true = true ) ) where true"); + "select from ( traverse * from Movie while $depth < 2 and ( true = true ) ) where" + + " true"); List list4 = new ArrayList<>(); while (result4.hasNext()) { diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/TruncateClassTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/TruncateClassTest.java index c8f2a7f229c..db20f6d72eb 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/TruncateClassTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/TruncateClassTest.java @@ -115,7 +115,8 @@ public void testTruncateVertexClassSubclasses() { database.command("create class TestTruncateVertexClassSuperclass").close(); database .command( - "create class TestTruncateVertexClassSubclass extends TestTruncateVertexClassSuperclass") + "create class TestTruncateVertexClassSubclass extends" + + " TestTruncateVertexClassSuperclass") .close(); database.command("insert into TestTruncateVertexClassSuperclass set name = 'foo'").close(); @@ -143,12 +144,14 @@ public void testTruncateVertexClassSubclassesWithIndex() { .close(); database .command( - "create index TestTruncateVertexClassSuperclassWithIndex_index on TestTruncateVertexClassSuperclassWithIndex (name) NOTUNIQUE") + "create index TestTruncateVertexClassSuperclassWithIndex_index on" + + " TestTruncateVertexClassSuperclassWithIndex (name) NOTUNIQUE") .close(); database .command( - "create class TestTruncateVertexClassSubclassWithIndex extends TestTruncateVertexClassSuperclassWithIndex") + "create class TestTruncateVertexClassSubclassWithIndex extends" + + " TestTruncateVertexClassSuperclassWithIndex") .close(); database diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/speed/FullTextIndexerTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/speed/FullTextIndexerTest.java index b334f33a1c2..072601b154c 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/speed/FullTextIndexerTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/speed/FullTextIndexerTest.java @@ -30,41 +30,47 @@ public static void main(String[] iArgs) throws InstantiationException, IllegalAc document.field("surname", "Miner"); document.field( "description", - "Jay Glenn Miner (May 31, 1932 to June 20, 1994), was a famous integrated circuit designer, known primarily for his " - + "work in multimedia chips and as the 'father of the Amiga'[1]. He received a BS in EECS from " - + "UC Berkeley in 1959. Miner started in the electronics industry with a number of designs in the " - + "medical world, including a remote-control pacemaker. He moved to Atari in the late 1970s. One of " - + "his first successes was to combine an entire breadboard of components into a single chip, known " - + "as the TIA. The TIA was the display hardware for the Atari 2600, which would go on to sell millions." - + " After working on the TIA he headed up the design of the follow-on chip set that would go on to" - + " be the basis of the Atari 8-bit family of home computers, known as ANTIC and CTIA. " - + "In the early 1980s Jay, along with other Atari staffers, had become fed up with management and " - + "decamped. They set up another chipset project under a new company in Santa Clara, called " - + "Hi-Toro (later renamed to Amiga Corporation), where they could have some creative freedom. " - + "There, they started to create a new Motorola 68000-based games console, codenamed Lorraine, " - + "that could be upgraded to a computer. To raise money for the Lorraine project, Amiga Corp." - + " designed and sold joysticks and game cartridges for popular game consoles such as the" - + " Atari 2600 and ColecoVision, as well as an odd input device called the Joyboard, essentially " - + "a joystick the player stood on. Atari continued to be interested in the team's efforts throughout" - + " this period, and funded them with $500,000 in capital in return for first use of their resulting" - + " chipset. The Amiga crew, having continuing serious financial problems, had sought more monetary" - + " support from investors that entire Spring. Amiga entered in to discussions with Commodore." - + " The discussions ultimately led to Commodore wanting to purchase Amiga outright, which would" - + " (from Commodore's viewpoint) cancel any outstanding contracts - including Atari Inc.'s." - + " So instead of Amiga delivering the chipset, Commodore delivered a check of $500,000 to Atari" - + " on Amiga's behalf, in effect returning the funds invested into Amiga for completion of the" - + " Lorraine chipset. The original Amiga (1985) Jay worked at Commodore-Amiga for several years," - + " in Los Gatos (CA). They made good progress at the beginning, but as Commodore management" - + " changed, they became marginalised and the original Amiga staff was fired or left out on a" - + " one-by-one basis, until the entire Los Gatos office was closed. Miner later worked as a" - + " consultant for Commodore until it went bankrupt. He was known as the 'Padre' (father) of" - + " the Amiga among Amiga users. Jay always took his dog 'Mitchy' (a cockapoo) with him wherever" - + " he went. While he worked at Atari, Mitchy even had her own ID-badge, and Mitchy's paw print" - + " is visible on the inside of the Amiga 1000 top cover, alongside the signatures of the" - + " engineers who worked on it. Jay endured kidney problems for most of his life, according" - + " to his wife, and relied on dialysis. His sister donated one of her own. Miner died due" - + " to complications from kidney failure at the age of 62, just two months after Commodore" - + " declared bankruptcy."); + "Jay Glenn Miner (May 31, 1932 to June 20, 1994), was a famous integrated circuit" + + " designer, known primarily for his work in multimedia chips and as the 'father of" + + " the Amiga'[1]. He received a BS in EECS from UC Berkeley in 1959. Miner started" + + " in the electronics industry with a number of designs in the medical world," + + " including a remote-control pacemaker. He moved to Atari in the late 1970s. One of" + + " his first successes was to combine an entire breadboard of components into a" + + " single chip, known as the TIA. The TIA was the display hardware for the Atari" + + " 2600, which would go on to sell millions. After working on the TIA he headed up" + + " the design of the follow-on chip set that would go on to be the basis of the" + + " Atari 8-bit family of home computers, known as ANTIC and CTIA. In the early 1980s" + + " Jay, along with other Atari staffers, had become fed up with management and" + + " decamped. They set up another chipset project under a new company in Santa Clara," + + " called Hi-Toro (later renamed to Amiga Corporation), where they could have some" + + " creative freedom. There, they started to create a new Motorola 68000-based games" + + " console, codenamed Lorraine, that could be upgraded to a computer. To raise money" + + " for the Lorraine project, Amiga Corp. designed and sold joysticks and game" + + " cartridges for popular game consoles such as the Atari 2600 and ColecoVision, as" + + " well as an odd input device called the Joyboard, essentially a joystick the" + + " player stood on. Atari continued to be interested in the team's efforts" + + " throughout this period, and funded them with $500,000 in capital in return for" + + " first use of their resulting chipset. The Amiga crew, having continuing serious" + + " financial problems, had sought more monetary support from investors that entire" + + " Spring. Amiga entered in to discussions with Commodore. The discussions" + + " ultimately led to Commodore wanting to purchase Amiga outright, which would (from" + + " Commodore's viewpoint) cancel any outstanding contracts - including Atari Inc.'s." + + " So instead of Amiga delivering the chipset, Commodore delivered a check of" + + " $500,000 to Atari on Amiga's behalf, in effect returning the funds invested into" + + " Amiga for completion of the Lorraine chipset. The original Amiga (1985) Jay" + + " worked at Commodore-Amiga for several years, in Los Gatos (CA). They made good" + + " progress at the beginning, but as Commodore management changed, they became" + + " marginalised and the original Amiga staff was fired or left out on a one-by-one" + + " basis, until the entire Los Gatos office was closed. Miner later worked as a" + + " consultant for Commodore until it went bankrupt. He was known as the 'Padre'" + + " (father) of the Amiga among Amiga users. Jay always took his dog 'Mitchy' (a" + + " cockapoo) with him wherever he went. While he worked at Atari, Mitchy even had" + + " her own ID-badge, and Mitchy's paw print is visible on the inside of the Amiga" + + " 1000 top cover, alongside the signatures of the engineers who worked on it. Jay" + + " endured kidney problems for most of his life, according to his wife, and relied" + + " on dialysis. His sister donated one of her own. Miner died due to complications" + + " from kidney failure at the age of 62, just two months after Commodore declared" + + " bankruptcy."); document.save(); } diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/speed/NotUniqueIndexSpeedTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/speed/NotUniqueIndexSpeedTest.java index 16123cc611e..ffe36b00316 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/speed/NotUniqueIndexSpeedTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/speed/NotUniqueIndexSpeedTest.java @@ -49,7 +49,8 @@ public void cycle() throws Exception { counter++; database.command( - "insert into test (x, y, z, j, k , l, m, indexdate), values (?, ?, ?, ?, ?, ?, ?, ?)", + "insert into test (x, y, z, j, k , l, m, indexdate), values (?, ?, ?," + + " ?, ?, ?, ?, ?)", fVal, fVal, fVal, diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/speed/SQLAsynchQuerySpeedTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/speed/SQLAsynchQuerySpeedTest.java index cf28c1825c3..3cbe739c269 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/speed/SQLAsynchQuerySpeedTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/speed/SQLAsynchQuerySpeedTest.java @@ -46,7 +46,8 @@ public void cycle() throws UnsupportedEncodingException { database .command( new OSQLAsynchQuery( - "select * from animal where column(0) < 5 or column(0) >= 3 and column(5) < 7", + "select * from animal where column(0) < 5 or column(0) >= 3 and column(5) <" + + " 7", new OCommandResultListener() { @Override public boolean result(Object iRecord) { diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/speed/SuperNodeInsertSpeedTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/speed/SuperNodeInsertSpeedTest.java index 452aebcdf9b..ac6bfc9dd5b 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/speed/SuperNodeInsertSpeedTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/speed/SuperNodeInsertSpeedTest.java @@ -16,7 +16,9 @@ import org.testng.Assert; import org.testng.annotations.Test; -/** @author Artem Orobets (enisher-at-gmail.com) */ +/** + * @author Artem Orobets (enisher-at-gmail.com) + */ /* * Copyright 2010-2016 OrientDB LTD (http://orientdb.com) * diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/CustomMethodFilterTestClass.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/CustomMethodFilterTestClass.java index bdc6f4fdd50..e7cda1b2e9b 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/CustomMethodFilterTestClass.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/CustomMethodFilterTestClass.java @@ -18,7 +18,9 @@ import java.util.List; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class CustomMethodFilterTestClass { protected String standardField; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/EmbeddedChild.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/EmbeddedChild.java index 4ac3f17a386..b1120355e9e 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/EmbeddedChild.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/EmbeddedChild.java @@ -16,7 +16,9 @@ */ package com.orientechnologies.orient.test.domain.base; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class EmbeddedChild { private String name; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/EnumTest.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/EnumTest.java index 3b5c6907e40..56afd0bcb8d 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/EnumTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/EnumTest.java @@ -16,7 +16,9 @@ */ package com.orientechnologies.orient.test.domain.base; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public enum EnumTest { ENUM1, ENUM2, diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/Instrument.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/Instrument.java index 1f9b30cda7a..ea1bcc58604 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/Instrument.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/Instrument.java @@ -16,7 +16,9 @@ */ package com.orientechnologies.orient.test.domain.base; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class Instrument extends IdObject { private String name; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaAttachDetachTestClass.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaAttachDetachTestClass.java index fa04c808c4e..8df79cd5504 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaAttachDetachTestClass.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaAttachDetachTestClass.java @@ -29,7 +29,9 @@ import javax.persistence.Transient; import javax.persistence.Version; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class JavaAttachDetachTestClass { public static final String testStatic = "10"; @Transient public String testTransient; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaBinaryDataTestClass.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaBinaryDataTestClass.java index 5d8185f7ea6..4d18924c21a 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaBinaryDataTestClass.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaBinaryDataTestClass.java @@ -17,7 +17,9 @@ import javax.persistence.Id; import javax.persistence.Version; -/** @author diegomtassis Diego Martin Tassis */ +/** + * @author diegomtassis Diego Martin Tassis + */ public class JavaBinaryDataTestClass { @Id private Object id; @Version private Object version; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaCascadeDeleteTestClass.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaCascadeDeleteTestClass.java index a8f9ac33372..e5fba67d372 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaCascadeDeleteTestClass.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaCascadeDeleteTestClass.java @@ -31,7 +31,9 @@ import javax.persistence.OneToOne; import javax.persistence.Version; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class JavaCascadeDeleteTestClass { @Id private String id; @Version private Object version; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaComplexTestClass.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaComplexTestClass.java index 5e1f30a45cd..173c313f321 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaComplexTestClass.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaComplexTestClass.java @@ -30,7 +30,9 @@ import javax.persistence.Id; import javax.persistence.Version; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class JavaComplexTestClass { @Id private String id; @Version private Object version; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaNoGenericCollectionsTestClass.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaNoGenericCollectionsTestClass.java index 11a58554233..868e3a7da44 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaNoGenericCollectionsTestClass.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaNoGenericCollectionsTestClass.java @@ -25,7 +25,9 @@ import javax.persistence.Id; import javax.persistence.Version; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class JavaNoGenericCollectionsTestClass { @Id private String id; @Version private Object version; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaSimpleArraysTestClass.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaSimpleArraysTestClass.java index 39b9a66e9d1..fd99b068c03 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaSimpleArraysTestClass.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaSimpleArraysTestClass.java @@ -20,7 +20,9 @@ import javax.persistence.Id; import javax.persistence.Version; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class JavaSimpleArraysTestClass { @Id private Object id; @Version private Object version; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaSimpleTestClass.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaSimpleTestClass.java index fad84a285c4..ed7738964b7 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaSimpleTestClass.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaSimpleTestClass.java @@ -20,7 +20,9 @@ import javax.persistence.Id; import javax.persistence.Version; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class JavaSimpleTestClass { @Id private Object id; @Version private Object version; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaTestInterface.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaTestInterface.java index 9a7e7892982..1734f1815d1 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaTestInterface.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/JavaTestInterface.java @@ -16,7 +16,9 @@ */ package com.orientechnologies.orient.test.domain.base; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public interface JavaTestInterface { public int getNumber(); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/Media.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/Media.java index 99c0c55f5b2..ab9429b859d 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/Media.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/Media.java @@ -22,7 +22,9 @@ import javax.persistence.OneToOne; import javax.persistence.Version; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class Media { @Id private Object id; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/Parent.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/Parent.java index 99ef469306e..bb789eed778 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/Parent.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/Parent.java @@ -18,7 +18,9 @@ import javax.persistence.Embedded; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class Parent { private String name; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/PersonTest.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/PersonTest.java index f00e0f28b98..25a8a301445 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/PersonTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/PersonTest.java @@ -19,7 +19,9 @@ import java.util.HashSet; import java.util.Set; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class PersonTest { private String firstname; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/Planet.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/Planet.java index 7c6d7960be9..4a45407bda7 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/Planet.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/Planet.java @@ -23,7 +23,9 @@ import javax.persistence.Id; import javax.persistence.Version; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class Planet { @Id private String id; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/Satellite.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/Satellite.java index c5b965b7a5f..6d812c30d6a 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/base/Satellite.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/base/Satellite.java @@ -19,7 +19,9 @@ import javax.persistence.Id; import javax.persistence.Version; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class Satellite { @Id private String id; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/business/Child.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/business/Child.java index 6cc5c6bf154..aaef1983c06 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/business/Child.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/business/Child.java @@ -19,7 +19,9 @@ import javax.persistence.Id; import javax.persistence.Version; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class Child { @Id private Object id; @Version private Object version; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/business/IdentityChild.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/business/IdentityChild.java index ae08d6d1067..3f8c3e09a43 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/business/IdentityChild.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/business/IdentityChild.java @@ -19,7 +19,9 @@ import javax.persistence.Id; import javax.persistence.Version; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class IdentityChild { @Id private Object id; @Version private Object version; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/cycle/CycleChild.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/cycle/CycleChild.java index 82d2befced8..6906576515e 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/cycle/CycleChild.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/cycle/CycleChild.java @@ -3,7 +3,9 @@ import java.util.HashSet; import java.util.Set; -/** @author Wouter de Vaal */ +/** + * @author Wouter de Vaal + */ public class CycleChild { private String name; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/cycle/CycleParent.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/cycle/CycleParent.java index b8bece13db1..507c7a8885f 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/cycle/CycleParent.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/cycle/CycleParent.java @@ -3,7 +3,9 @@ import java.util.ArrayList; import java.util.List; -/** @author Wouter de Vaal */ +/** + * @author Wouter de Vaal + */ public class CycleParent { private String name; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/cycle/GrandChild.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/cycle/GrandChild.java index 80db9e45f59..41de4d7bf3c 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/cycle/GrandChild.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/cycle/GrandChild.java @@ -1,6 +1,8 @@ package com.orientechnologies.orient.test.domain.cycle; -/** @author Wouter de Vaal */ +/** + * @author Wouter de Vaal + */ public class GrandChild { private String name; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/inheritance/InheritanceTestAbstractClass.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/inheritance/InheritanceTestAbstractClass.java index bf5bfb73e4a..a3861df70a8 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/inheritance/InheritanceTestAbstractClass.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/inheritance/InheritanceTestAbstractClass.java @@ -16,7 +16,9 @@ */ package com.orientechnologies.orient.test.domain.inheritance; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public abstract class InheritanceTestAbstractClass { protected int cField; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/inheritance/InheritanceTestBaseClass.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/inheritance/InheritanceTestBaseClass.java index dbd56f7cfed..5e97c88ddd6 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/inheritance/InheritanceTestBaseClass.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/inheritance/InheritanceTestBaseClass.java @@ -19,7 +19,9 @@ import javax.persistence.Id; import javax.persistence.Version; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class InheritanceTestBaseClass extends InheritanceTestAbstractClass { @Id public String id; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/inheritance/InheritanceTestClass.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/inheritance/InheritanceTestClass.java index c0c725c06b5..08ce5cbb57d 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/inheritance/InheritanceTestClass.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/inheritance/InheritanceTestClass.java @@ -16,7 +16,9 @@ */ package com.orientechnologies.orient.test.domain.inheritance; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class InheritanceTestClass extends InheritanceTestBaseClass { public String bField; } diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/lazy/LazyChild.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/lazy/LazyChild.java index 66b84785879..fcd44505f80 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/lazy/LazyChild.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/lazy/LazyChild.java @@ -3,7 +3,9 @@ import com.orientechnologies.orient.core.id.ORID; import javax.persistence.Id; -/** @author Wouter de Vaal */ +/** + * @author Wouter de Vaal + */ public class LazyChild { @Id private ORID id; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/lazy/LazyParent.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/lazy/LazyParent.java index 2ebba54c403..62828cd23fd 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/lazy/LazyParent.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/lazy/LazyParent.java @@ -4,7 +4,9 @@ import javax.persistence.Id; import javax.persistence.OneToOne; -/** @author Wouter de Vaal */ +/** + * @author Wouter de Vaal + */ public class LazyParent { @Id private String id; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/schemageneration/JavaTestSchemaGeneration.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/schemageneration/JavaTestSchemaGeneration.java index 95356846deb..82eb3130e53 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/schemageneration/JavaTestSchemaGeneration.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/schemageneration/JavaTestSchemaGeneration.java @@ -31,7 +31,9 @@ import javax.persistence.Transient; import javax.persistence.Version; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class JavaTestSchemaGeneration { @Id private Object id; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/domain/schemageneration/TestSchemaGenerationChild.java b/tests/src/test/java/com/orientechnologies/orient/test/domain/schemageneration/TestSchemaGenerationChild.java index ea854dae160..ddf3a7d99f0 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/domain/schemageneration/TestSchemaGenerationChild.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/domain/schemageneration/TestSchemaGenerationChild.java @@ -19,7 +19,9 @@ import javax.persistence.Id; import javax.persistence.Version; -/** @author Luca Molino (molino.luca--at--gmail.com) */ +/** + * @author Luca Molino (molino.luca--at--gmail.com) + */ public class TestSchemaGenerationChild { @Id private Object id; @Version private Object version; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/internal/FreezeMultiThreadingTestNonTX.java b/tests/src/test/java/com/orientechnologies/orient/test/internal/FreezeMultiThreadingTestNonTX.java index 8c9d41ca846..6b8002cbc4c 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/internal/FreezeMultiThreadingTestNonTX.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/internal/FreezeMultiThreadingTestNonTX.java @@ -360,7 +360,8 @@ public Void call() throws Exception { int number = deleteCounter.getAndIncrement(); while (number < DOCUMENT_COUNT) { // wait while necessary document will be created - while (number > createCounter.get()) ; + while (number > createCounter.get()) + ; try { List execute; @@ -424,7 +425,8 @@ public Void call() throws Exception { int number = transactionalDeleteCounter.getAndIncrement(); while (number < TRANSACTIONAL_DOCUMENT_COUNT) { // wait while necessary document will be created - while (number > transactionalCreateCounter.get()) ; + while (number > transactionalCreateCounter.get()) + ; try { List execute; diff --git a/tests/src/test/java/com/orientechnologies/orient/test/internal/LockMultithreadingTest.java b/tests/src/test/java/com/orientechnologies/orient/test/internal/LockMultithreadingTest.java index bca40e70b1c..bd0542248e8 100755 --- a/tests/src/test/java/com/orientechnologies/orient/test/internal/LockMultithreadingTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/internal/LockMultithreadingTest.java @@ -19,7 +19,9 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -/** @author Artem Loginov (logart2007-at-gmail.com) */ +/** + * @author Artem Loginov (logart2007-at-gmail.com) + */ @Test public class LockMultithreadingTest { private static final int CREATOR_THREAD_COUNT = 10; @@ -121,7 +123,8 @@ public Void call() throws Exception { int number = deleteCounter.getAndIncrement(); while (number < DOCUMENT_COUNT) { // wait while necessary document will be created - while (number > createCounter.get()) ; + while (number > createCounter.get()) + ; try { ODatabaseRecordThreadLocal.instance().set(db); diff --git a/tests/src/test/java/com/orientechnologies/orient/test/java/lang/StringBrowsingSpeedTest.java b/tests/src/test/java/com/orientechnologies/orient/test/java/lang/StringBrowsingSpeedTest.java index 26ef54ec17f..b366261c789 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/java/lang/StringBrowsingSpeedTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/java/lang/StringBrowsingSpeedTest.java @@ -17,7 +17,13 @@ public class StringBrowsingSpeedTest { private static final String S = - "OrientDB is an Open Source NoSQL DBMS with both the features of Document and Graph DBMSs. It's written in Java and it's amazing fast: can store up to 150,000 records per second on common hardware. Even if it's Document based database the relationships are managed as in Graph Databases with direct connections among records. You can traverse entire or part of trees and graphs of records in few milliseconds. Supports schema-less, schema-full and schema-mixed modes. Has a strong security profiling system based on user and roles and support the SQL between"; + "OrientDB is an Open Source NoSQL DBMS with both the features of Document and Graph DBMSs." + + " It's written in Java and it's amazing fast: can store up to 150,000 records per" + + " second on common hardware. Even if it's Document based database the relationships are" + + " managed as in Graph Databases with direct connections among records. You can traverse" + + " entire or part of trees and graphs of records in few milliseconds. Supports" + + " schema-less, schema-full and schema-mixed modes. Has a strong security profiling" + + " system based on user and roles and support the SQL between"; private static final int MAX = 1000000000; public static final void main(String[] args) { diff --git a/tests/src/test/java/com/orientechnologies/orient/test/object/MultipleObjectDbInstancesTest.java b/tests/src/test/java/com/orientechnologies/orient/test/object/MultipleObjectDbInstancesTest.java index 0b41c0c4449..779d7bf800a 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/object/MultipleObjectDbInstancesTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/object/MultipleObjectDbInstancesTest.java @@ -42,7 +42,8 @@ public class MultipleObjectDbInstancesTest { public void testTwiceCreateDBSchemaRegistered() throws IOException { OrientDB orientDB = new OrientDB("memory:", OrientDBConfig.defaultConfig()); orientDB.execute( - "create database MultipleDbInstancesTest_first memory users(admin identified by 'adminpwd' role admin)"); + "create database MultipleDbInstancesTest_first memory users(admin identified by 'adminpwd'" + + " role admin)"); ODatabaseDocumentInternal db = (ODatabaseDocumentInternal) orientDB.open("MultipleDbInstancesTest_first", "admin", "adminpwd"); @@ -56,7 +57,8 @@ public void testTwiceCreateDBSchemaRegistered() throws IOException { objectDb.close(); orientDB.execute( - "create database MultipleDbInstancesTest_second memory users(admin identified by 'adminpwd' role admin)"); + "create database MultipleDbInstancesTest_second memory users(admin identified by 'adminpwd'" + + " role admin)"); ODatabaseDocumentInternal db1 = (ODatabaseDocumentInternal) orientDB.open("MultipleDbInstancesTest_second", "admin", "adminpwd"); diff --git a/tools/pom.xml b/tools/pom.xml index 7244f8f81b6..01ab8751890 100755 --- a/tools/pom.xml +++ b/tools/pom.xml @@ -36,6 +36,8 @@ com.orientechnologies.orient.console.OConsoleDatabaseApp UTF-8 + + 2023-01-01T00:00:00Z diff --git a/tools/src/main/java/com/orientechnologies/orient/console/OConsoleDatabaseApp.java b/tools/src/main/java/com/orientechnologies/orient/console/OConsoleDatabaseApp.java index 49530b0c28f..d4cde574446 100755 --- a/tools/src/main/java/com/orientechnologies/orient/console/OConsoleDatabaseApp.java +++ b/tools/src/main/java/com/orientechnologies/orient/console/OConsoleDatabaseApp.java @@ -211,7 +211,8 @@ private void checkDefaultPassword(String database, String user, String password) && WARNING_DEFAULT_USERS.getValueAsBoolean()) { message( String.format( - "IMPORTANT! Using default password is unsafe, please change password for user '%s' on database '%s'", + "IMPORTANT! Using default password is unsafe, please change password for user '%s' on" + + " database '%s'", user, database)); } } @@ -224,7 +225,8 @@ public void connect( @ConsoleParameter( name = "url", description = - "The url of the remote server or the database to connect to in the format ':'") + "The url of the remote server or the database to connect to in the format" + + " ':'") String iURL, @ConsoleParameter(name = "user", description = "User name") String iUserName, @ConsoleParameter(name = "password", description = "User password", optional = true) @@ -294,7 +296,8 @@ public void disconnect() { @ConsoleCommand( description = - "Create a new database. For encrypted database or portion of database, set the variable 'storage.encryptionKey' with the key to use", + "Create a new database. For encrypted database or portion of database, set the variable" + + " 'storage.encryptionKey' with the key to use", onlineHelp = "Console-Command-Create-Database") public void createDatabase( @ConsoleParameter( @@ -312,13 +315,15 @@ public void createDatabase( name = "storage-type", optional = true, description = - "The type of the storage: 'plocal' for disk-based databases and 'memory' for in-memory database") + "The type of the storage: 'plocal' for disk-based databases and 'memory' for" + + " in-memory database") String storageType, @ConsoleParameter( name = "db-type", optional = true, description = - "The type of the database used between 'document' and 'graph'. By default is graph.") + "The type of the database used between 'document' and 'graph'. By default is" + + " graph.") String databaseType, @ConsoleParameter( name = "[options]", @@ -432,7 +437,9 @@ public void listDatabases() throws IOException { } } else { message( - "\nNot connected to the Server instance. You've to connect to the Server using server's credentials (look at orientdb-*server-config.xml file)"); + "\n" + + "Not connected to the Server instance. You've to connect to the Server using" + + " server's credentials (look at orientdb-*server-config.xml file)"); } out.println(); } @@ -570,7 +577,15 @@ public void begin() throws IOException { if (currentDatabase.isRemote()) { message( - "\nWARNING - Transactions are not supported from console in remote, please use an sql script: \neg.\n\nscript sql\nbegin;\n\ncommit;\nend\n\n"); + "\n" + + "WARNING - Transactions are not supported from console in remote, please use an sql" + + " script: \n" + + "eg.\n\n" + + "script sql\n" + + "begin;\n" + + "\n" + + "commit;\n" + + "end\n\n"); return; } @@ -651,7 +666,8 @@ public void loadRecord( @ConsoleParameter( name = "record-id", description = - "The unique Record Id of the record to load. If you do not have the Record Id, execute a query first") + "The unique Record Id of the record to load. If you do not have the Record Id," + + " execute a query first") String iRecordId, @ConsoleParameter(name = "fetch-plan", description = "The fetch plan to load the record with") String iFetchPlan) { @@ -663,7 +679,8 @@ public void loadRecord( @ConsoleParameter( name = "record-id", description = - "The unique Record Id of the record to load. If you do not have the Record Id, execute a query first") + "The unique Record Id of the record to load. If you do not have the Record Id," + + " execute a query first") String iRecordId) { loadRecordInternal(iRecordId, null); } @@ -673,7 +690,8 @@ public void reloadRecord( @ConsoleParameter( name = "record-id", description = - "The unique Record Id of the record to load. If you do not have the Record Id, execute a query first") + "The unique Record Id of the record to load. If you do not have the Record Id," + + " execute a query first") String iRecordId, @ConsoleParameter(name = "fetch-plan", description = "The fetch plan to load the record with") String iFetchPlan) { @@ -687,7 +705,8 @@ public void reloadRecord( @ConsoleParameter( name = "record-id", description = - "The unique Record Id of the record to load. If you do not have the Record Id, execute a query first") + "The unique Record Id of the record to load. If you do not have the Record Id," + + " execute a query first") String iRecordId) { reloadRecordInternal(iRecordId, null); } @@ -1311,7 +1330,8 @@ public void js( @ConsoleParameter( name = "text", description = - "The javascript to execute. Use 'db' to reference to a document database, 'gdb' for a graph database") + "The javascript to execute. Use 'db' to reference to a document database, 'gdb'" + + " for a graph database") final String iText) { if (iText == null) return; @@ -1352,7 +1372,8 @@ public void jss( @ConsoleParameter( name = "text", description = - "The javascript to execute. Use 'db' to reference to a document database, 'gdb' for a graph database") + "The javascript to execute. Use 'db' to reference to a document database, 'gdb'" + + " for a graph database") final String iText) { checkForRemoteServer(); @@ -1362,7 +1383,9 @@ public void jss( @SuppressWarnings("unchecked") @ConsoleCommand( description = - "Set a server user. If the user already exists, the password and permissions are updated. For more information look at http://orientdb.com/docs/last/Security.html#orientdb-server-security", + "Set a server user. If the user already exists, the password and permissions are updated." + + " For more information look at" + + " http://orientdb.com/docs/last/Security.html#orientdb-server-security", onlineHelp = "Console-Command-Set-Server-User") public void setServerUser( @ConsoleParameter(name = "user-name", description = "User name") String iServerUserName, @@ -1371,7 +1394,8 @@ public void setServerUser( @ConsoleParameter( name = "user-permissions", description = - "Permissions, look at http://orientdb.com/docs/last/Security.html#servers-resources") + "Permissions, look at" + + " http://orientdb.com/docs/last/Security.html#servers-resources") String iPermissions) { if (iServerUserName == null || iServerUserName.length() == 0) @@ -1405,7 +1429,8 @@ public void setServerUser( @SuppressWarnings("unchecked") @ConsoleCommand( description = - "Drop a server user. For more information look at http://orientdb.com/docs/last/Security.html#orientdb-server-security", + "Drop a server user. For more information look at" + + " http://orientdb.com/docs/last/Security.html#orientdb-server-security", onlineHelp = "Console-Command-Drop-Server-User") public void dropServerUser( @ConsoleParameter(name = "user-name", description = "User name") String iServerUserName) { @@ -1438,7 +1463,8 @@ public void dropServerUser( @SuppressWarnings("unchecked") @ConsoleCommand( description = - "Display all the server user names. For more information look at http://orientdb.com/docs/last/Security.html#orientdb-server-security", + "Display all the server user names. For more information look at" + + " http://orientdb.com/docs/last/Security.html#orientdb-server-security", onlineHelp = "Console-Command-List-Server-User") public void listServerUsers() { @@ -2338,7 +2364,8 @@ public void dictionaryGet( @ConsoleCommand( description = - "Insert or modify an entry in the database dictionary. The entry is comprised of key=String, value=record-id", + "Insert or modify an entry in the database dictionary. The entry is comprised of" + + " key=String, value=record-id", onlineHelp = "Console-Command-Dictionary-Put") public void dictionaryPut( @ConsoleParameter(name = "key", description = "The key to bind") final String iKey, @@ -2418,7 +2445,8 @@ public void repairDatabase( @ConsoleParameter( name = "options", description = - "Options: [--fix-graph] [--force-embedded-ridbags] [--fix-links] [-v]] [--fix-ridbags] [--fix-bonsai]", + "Options: [--fix-graph] [--force-embedded-ridbags] [--fix-links] [-v]]" + + " [--fix-ridbags] [--fix-bonsai]", optional = true) String iOptions) throws IOException { @@ -3164,7 +3192,8 @@ private RESULT connectEnv(String iCommand) { protected void checkForRemoteServer() { if (orientDB == null || OrientDBInternal.extract(orientDB).isEmbedded()) throw new OSystemException( - "Remote server is not connected. Use 'connect remote:[:][/]' to connect"); + "Remote server is not connected. Use 'connect remote:[:][/]'" + + " to connect"); } /** Should be used only by console commands */ @@ -3510,11 +3539,13 @@ else if (value instanceof Iterator) { } else if (currentRecord instanceof OBlob) { OBlob rec = (OBlob) currentRecord; message( - "\n+-------------------------------------------------------------------------------------------------+"); + "\n" + + "+-------------------------------------------------------------------------------------------------+"); message( "\n| Bytes - @rid: %s @version: %d", rec.getIdentity().toString(), rec.getVersion()); message( - "\n+-------------------------------------------------------------------------------------------------+"); + "\n" + + "+-------------------------------------------------------------------------------------------------+"); final byte[] value = rec.toStream(); final int max = @@ -3525,18 +3556,21 @@ else if (value instanceof Iterator) { message("%03d", Array.getByte(value, i)); } message( - "\n+-------------------------------------------------------------------------------------------------+"); + "\n" + + "+-------------------------------------------------------------------------------------------------+"); } else { message( - "\n+-------------------------------------------------------------------------------------------------+"); + "\n" + + "+-------------------------------------------------------------------------------------------------+"); message( "\n| %s - record id: %s v.%d", currentRecord.getClass().getSimpleName(), currentRecord.getIdentity().toString(), currentRecord.getVersion()); message( - "\n+-------------------------------------------------------------------------------------------------+"); + "\n" + + "+-------------------------------------------------------------------------------------------------+"); } out.println(); } diff --git a/tools/src/main/java/com/orientechnologies/orient/stresstest/workload/OBaseWorkload.java b/tools/src/main/java/com/orientechnologies/orient/stresstest/workload/OBaseWorkload.java index d6e2c124979..66d5b05e735 100755 --- a/tools/src/main/java/com/orientechnologies/orient/stresstest/workload/OBaseWorkload.java +++ b/tools/src/main/java/com/orientechnologies/orient/stresstest/workload/OBaseWorkload.java @@ -73,7 +73,10 @@ public String toOutput(final int leftSpaces) { for (int i = 0; i < leftSpaces; ++i) indent.append(' '); return String.format( - "\n%s- Throughput: %.3f/sec (Avg %.3fms/op)\n%s- Latency Avg: %.3fms/op (%dth percentile) - Min: %.3fms - 99th Perc: %.3fms - 99.9th Perc: %.3fms - Max: %.3fms - Conflicts: %d", + "\n" + + "%s- Throughput: %.3f/sec (Avg %.3fms/op)\n" + + "%s- Latency Avg: %.3fms/op (%dth percentile) - Min: %.3fms - 99th Perc: %.3fms -" + + " 99.9th Perc: %.3fms - Max: %.3fms - Conflicts: %d", indent, total * 1000 / (float) totalTime, throughputAvgNs / 1000000f, diff --git a/tools/src/test/java/com/orientechnologies/orient/console/OConsoleDatabaseAppTest.java b/tools/src/test/java/com/orientechnologies/orient/console/OConsoleDatabaseAppTest.java index e98fdd38a9a..bb5a4398918 100644 --- a/tools/src/test/java/com/orientechnologies/orient/console/OConsoleDatabaseAppTest.java +++ b/tools/src/test/java/com/orientechnologies/orient/console/OConsoleDatabaseAppTest.java @@ -56,7 +56,8 @@ public void testWrongCommand() { builder.append("connect env embedded:./target/ root root;\n"); builder.append( - "create database OConsoleDatabaseAppTest2 memory users (admin identified by 'admin' role admin);\n"); + "create database OConsoleDatabaseAppTest2 memory users (admin identified by 'admin' role" + + " admin);\n"); builder.append("open OConsoleDatabaseAppTest2 admin admin;\n"); builder.append("create class foo;\n"); @@ -120,7 +121,8 @@ public void testDumpRecordDetails() { c.console().executeServerCommand("connect env embedded:./target/ root root"); c.console() .executeServerCommand( - "create database OConsoleDatabaseAppTestDumpRecordDetails memory users (admin identified by 'admin' role admin)"); + "create database OConsoleDatabaseAppTestDumpRecordDetails memory users (admin" + + " identified by 'admin' role admin)"); c.console().open("OConsoleDatabaseAppTestDumpRecordDetails", "admin", "admin"); c.console().createClass("class foo"); @@ -188,7 +190,8 @@ public void testDeclareIntent() { c.console().executeServerCommand("connect env embedded:./target/ root root"); c.console() .executeServerCommand( - "create database OConsoleDatabaseAppTestDeclareIntent memory users (admin identified by 'admin' role admin)"); + "create database OConsoleDatabaseAppTestDeclareIntent memory users (admin identified" + + " by 'admin' role admin)"); c.console().open("OConsoleDatabaseAppTestDeclareIntent", "admin", "admin"); c.resetOutput(); @@ -261,7 +264,8 @@ public void testSimple() { builder.append("traverse out() from V;\n"); builder.append( - "create edge from (select from V where name = 'foo') to (select from V where name = 'bar');\n"); + "create edge from (select from V where name = 'foo') to (select from V where name =" + + " 'bar');\n"); builder.append("traverse out() from V;\n");