Selaa lähdekoodia

Merge branch 'master' of https://github.com/DMDirc/Parser

pull/164/head
Greg Holmes 7 vuotta sitten
vanhempi
commit
28916fd83a

+ 9
- 5
build.gradle Näytä tiedosto

@@ -79,7 +79,11 @@ subprojects {
79 79
         repositories {
80 80
             maven {
81 81
                 name 'snapshots'
82
-                url 'http://artifactory.dmdirc.com/artifactory/repo'
82
+                url 'http://artifactory.dmdirc.com/artifactory/snapshots'
83
+                credentials {
84
+                    username System.getenv('ARTIFACTORY_USER')
85
+                    password System.getenv('ARTIFACTORY_PASSWORD')
86
+                }
83 87
             }
84 88
         }
85 89
     }
@@ -92,19 +96,19 @@ subprojects {
92 96
     dependencies {
93 97
         compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
94 98
         compile group: 'com.squareup.dagger', name: 'dagger-compiler', version: '1.2.5'
95
-        compile group: 'com.google.auto.value', name: 'auto-value', version: '1.2'
99
+        compile group: 'com.google.auto.value', name: 'auto-value', version: '1.3'
96 100
 
97 101
         compile group: 'org.slf4j', name: 'slf4j-api', version:'1.7.21'
98 102
         compile group: 'com.squareup.dagger', name: 'dagger', version: '1.2.5'
99 103
         compile group: 'com.google.guava', name:'guava', version: '19.0'
100 104
 
101
-        compile group: 'net.engio', name: 'mbassador', version: '1.2.4.2'
105
+        compile group: 'net.engio', name: 'mbassador', version: '1.3.0'
102 106
         compile group: 'de.odysseus.juel', name: 'juel-api', version: '2.2.7'
103 107
         compile group: 'de.odysseus.juel', name: 'juel-impl', version: '2.2.7'
104 108
         compile group: 'de.odysseus.juel', name: 'juel-spi', version: '2.2.7'
105 109
 
106 110
         testCompile group: 'junit', name: 'junit', version: '4.12'
107
-        testCompile group: 'org.mockito', name: 'mockito-core', version: '1.10.19'
111
+        testCompile group: 'org.mockito', name: 'mockito-core', version: '2.2.7'
108 112
     }
109 113
 
110 114
     task publishSnapshot(dependsOn: 'publishMavenJavaPublicationToSnapshotsRepository') << {
@@ -126,7 +130,7 @@ subprojects {
126 130
 }
127 131
 
128 132
 task wrapper(type: Wrapper) {
129
-    gradleVersion = '2.13'
133
+    gradleVersion = '3.1'
130 134
 }
131 135
 
132 136
 def find(name) {

+ 7
- 0
circle.yml Näytä tiedosto

@@ -18,3 +18,10 @@ dependencies:
18 18
 test:
19 19
   override:
20 20
     - ./gradlew test jacocoTestReport coveralls
21
+
22
+deployment:
23
+  snapshots:
24
+    branch: master
25
+    owner: DMDirc
26
+    commands:
27
+      - ./gradlew publishSnapshot

+ 1
- 1
common/src/main/java/com/dmdirc/parser/interfaces/ClientInfo.java Näytä tiedosto

@@ -82,7 +82,7 @@ public interface ClientInfo {
82 82
      *
83 83
      * @return int with the count of known channels
84 84
      */
85
-    public List<ChannelClientInfo> getChannelClients();
85
+    List<ChannelClientInfo> getChannelClients();
86 86
 
87 87
     /**
88 88
      * Get the away state of a user.

+ 0
- 7
common/src/main/java/com/dmdirc/parser/interfaces/ProtocolDescription.java Näytä tiedosto

@@ -32,13 +32,6 @@ import java.net.URI;
32 32
  */
33 33
 public interface ProtocolDescription {
34 34
 
35
-    /**
36
-     * Retrieves the default port to use for this protocol if none is specified.
37
-     *
38
-     * @return This protocol's default port
39
-     */
40
-    int getDefaultPort();
41
-
42 35
     /**
43 36
      * Parses the specified hostmask into an array containing a nickname,
44 37
      * username and hostname, in that order.

BIN
gradle/wrapper/gradle-wrapper.jar Näytä tiedosto


+ 2
- 2
gradle/wrapper/gradle-wrapper.properties Näytä tiedosto

@@ -1,6 +1,6 @@
1
-#Thu May 05 16:42:15 BST 2016
1
+#Thu Oct 27 18:07:37 BST 2016
2 2
 distributionBase=GRADLE_USER_HOME
3 3
 distributionPath=wrapper/dists
4 4
 zipStoreBase=GRADLE_USER_HOME
5 5
 zipStorePath=wrapper/dists
6
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip
6
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip

+ 31
- 26
gradlew Näytä tiedosto

@@ -6,12 +6,30 @@
6 6
 ##
7 7
 ##############################################################################
8 8
 
9
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10
-DEFAULT_JVM_OPTS=""
9
+# Attempt to set APP_HOME
10
+# Resolve links: $0 may be a link
11
+PRG="$0"
12
+# Need this for relative symlinks.
13
+while [ -h "$PRG" ] ; do
14
+    ls=`ls -ld "$PRG"`
15
+    link=`expr "$ls" : '.*-> \(.*\)$'`
16
+    if expr "$link" : '/.*' > /dev/null; then
17
+        PRG="$link"
18
+    else
19
+        PRG=`dirname "$PRG"`"/$link"
20
+    fi
21
+done
22
+SAVED="`pwd`"
23
+cd "`dirname \"$PRG\"`/" >/dev/null
24
+APP_HOME="`pwd -P`"
25
+cd "$SAVED" >/dev/null
11 26
 
12 27
 APP_NAME="Gradle"
13 28
 APP_BASE_NAME=`basename "$0"`
14 29
 
30
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31
+DEFAULT_JVM_OPTS=""
32
+
15 33
 # Use the maximum available, or set MAX_FD != -1 to use that value.
16 34
 MAX_FD="maximum"
17 35
 
@@ -30,6 +48,7 @@ die ( ) {
30 48
 cygwin=false
31 49
 msys=false
32 50
 darwin=false
51
+nonstop=false
33 52
 case "`uname`" in
34 53
   CYGWIN* )
35 54
     cygwin=true
@@ -40,31 +59,11 @@ case "`uname`" in
40 59
   MINGW* )
41 60
     msys=true
42 61
     ;;
62
+  NONSTOP* )
63
+    nonstop=true
64
+    ;;
43 65
 esac
44 66
 
45
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
46
-if $cygwin ; then
47
-    [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48
-fi
49
-
50
-# Attempt to set APP_HOME
51
-# Resolve links: $0 may be a link
52
-PRG="$0"
53
-# Need this for relative symlinks.
54
-while [ -h "$PRG" ] ; do
55
-    ls=`ls -ld "$PRG"`
56
-    link=`expr "$ls" : '.*-> \(.*\)$'`
57
-    if expr "$link" : '/.*' > /dev/null; then
58
-        PRG="$link"
59
-    else
60
-        PRG=`dirname "$PRG"`"/$link"
61
-    fi
62
-done
63
-SAVED="`pwd`"
64
-cd "`dirname \"$PRG\"`/" >&-
65
-APP_HOME="`pwd -P`"
66
-cd "$SAVED" >&-
67
-
68 67
 CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 68
 
70 69
 # Determine the Java command to use to start the JVM.
@@ -90,7 +89,7 @@ location of your Java installation."
90 89
 fi
91 90
 
92 91
 # Increase the maximum file descriptors if we can.
93
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
92
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
94 93
     MAX_FD_LIMIT=`ulimit -H -n`
95 94
     if [ $? -eq 0 ] ; then
96 95
         if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@@ -114,6 +113,7 @@ fi
114 113
 if $cygwin ; then
115 114
     APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 115
     CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116
+    JAVACMD=`cygpath --unix "$JAVACMD"`
117 117
 
118 118
     # We build the pattern for arguments to be converted via cygpath
119 119
     ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
@@ -161,4 +161,9 @@ function splitJvmOpts() {
161 161
 eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 162
 JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 163
 
164
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
165
+if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then
166
+  cd "$(dirname "$0")"
167
+fi
168
+
164 169
 exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

+ 4
- 10
gradlew.bat Näytä tiedosto

@@ -8,14 +8,14 @@
8 8
 @rem Set local scope for the variables with windows NT shell
9 9
 if "%OS%"=="Windows_NT" setlocal
10 10
 
11
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12
-set DEFAULT_JVM_OPTS=
13
-
14 11
 set DIRNAME=%~dp0
15 12
 if "%DIRNAME%" == "" set DIRNAME=.
16 13
 set APP_BASE_NAME=%~n0
17 14
 set APP_HOME=%DIRNAME%
18 15
 
16
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17
+set DEFAULT_JVM_OPTS=
18
+
19 19
 @rem Find java.exe
20 20
 if defined JAVA_HOME goto findJavaFromJavaHome
21 21
 
@@ -46,10 +46,9 @@ echo location of your Java installation.
46 46
 goto fail
47 47
 
48 48
 :init
49
-@rem Get command-line arguments, handling Windowz variants
49
+@rem Get command-line arguments, handling Windows variants
50 50
 
51 51
 if not "%OS%" == "Windows_NT" goto win9xME_args
52
-if "%@eval[2+2]" == "4" goto 4NT_args
53 52
 
54 53
 :win9xME_args
55 54
 @rem Slurp the command line arguments.
@@ -60,11 +59,6 @@ set _SKIP=2
60 59
 if "x%~1" == "x" goto execute
61 60
 
62 61
 set CMD_LINE_ARGS=%*
63
-goto execute
64
-
65
-:4NT_args
66
-@rem Get arguments from the 4NT Shell from JP Software
67
-set CMD_LINE_ARGS=%$
68 62
 
69 63
 :execute
70 64
 @rem Setup the command line

+ 1
- 5
irc/src/main/java/com/dmdirc/parser/irc/IRCParser.java Näytä tiedosto

@@ -1532,11 +1532,7 @@ public class IRCParser extends BaseSocketAwareParser implements SecureParser, En
1532 1532
 
1533 1533
         for (ChannelJoinRequest channel : channels) {
1534 1534
             // Make sure we have a list to put stuff in.
1535
-            StringBuffer list = joinMap.get(channel.getPassword());
1536
-            if (list == null) {
1537
-                list = new StringBuffer();
1538
-                joinMap.put(channel.getPassword(), list);
1539
-            }
1535
+            StringBuffer list = joinMap.computeIfAbsent(channel.getPassword(), k -> new StringBuffer());
1540 1536
 
1541 1537
             // Add the channel to the list. If the name is invalid and
1542 1538
             // autoprefix is off we will just skip this channel.

+ 0
- 5
irc/src/main/java/com/dmdirc/parser/irc/IRCProtocolDescription.java Näytä tiedosto

@@ -33,11 +33,6 @@ import java.net.URI;
33 33
  */
34 34
 public class IRCProtocolDescription implements ProtocolDescription {
35 35
 
36
-    @Override
37
-    public int getDefaultPort() {
38
-        return 6667;
39
-    }
40
-
41 36
     @Override
42 37
     public String[] parseHostmask(final String hostmask) {
43 38
         return IRCClientInfo.parseHostFull(hostmask);

+ 0
- 1
irc/src/main/java/com/dmdirc/parser/irc/events/IRCDataInEvent.java Näytä tiedosto

@@ -23,7 +23,6 @@
23 23
 package com.dmdirc.parser.irc.events;
24 24
 
25 25
 import com.dmdirc.parser.events.DataInEvent;
26
-import com.dmdirc.parser.interfaces.Parser;
27 26
 import com.dmdirc.parser.irc.IRCParser;
28 27
 import com.dmdirc.parser.irc.IRCReader.ReadLine;
29 28
 

+ 0
- 2
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessJoin.java Näytä tiedosto

@@ -26,7 +26,6 @@ import com.dmdirc.parser.common.ParserError;
26 26
 import com.dmdirc.parser.common.QueuePriority;
27 27
 import com.dmdirc.parser.events.ChannelJoinEvent;
28 28
 import com.dmdirc.parser.events.ChannelSelfJoinEvent;
29
-import com.dmdirc.parser.events.DataOutEvent;
30 29
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
31 30
 import com.dmdirc.parser.interfaces.ChannelInfo;
32 31
 import com.dmdirc.parser.irc.CapabilityState;
@@ -39,7 +38,6 @@ import com.dmdirc.parser.irc.PrefixModeManager;
39 38
 import com.dmdirc.parser.irc.ProcessorNotFoundException;
40 39
 import com.dmdirc.parser.irc.events.IRCDataOutEvent;
41 40
 import net.engio.mbassy.listener.Handler;
42
-import net.engio.mbassy.listener.Invoke;
43 41
 
44 42
 import java.time.LocalDateTime;
45 43
 import java.util.Arrays;

+ 0
- 1
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessMessage.java Näytä tiedosto

@@ -53,7 +53,6 @@ import com.dmdirc.parser.irc.ProcessorNotFoundException;
53 53
 import com.dmdirc.parser.irc.TimestampedIRCProcessor;
54 54
 
55 55
 import java.time.LocalDateTime;
56
-import java.util.Date;
57 56
 import java.util.regex.PatternSyntaxException;
58 57
 
59 58
 import javax.inject.Inject;

+ 22
- 23
irc/src/test/java/com/dmdirc/parser/irc/IRCReaderTest.java Näytä tiedosto

@@ -24,20 +24,27 @@ package com.dmdirc.parser.irc;
24 24
 
25 25
 import com.dmdirc.parser.interfaces.Encoder;
26 26
 import com.dmdirc.parser.irc.IRCReader.ReadLine;
27
-
28 27
 import java.io.ByteArrayInputStream;
29 28
 import java.io.IOException;
30 29
 import java.io.InputStream;
31 30
 import java.nio.charset.Charset;
32 31
 import java.text.SimpleDateFormat;
33
-import java.util.Arrays;
34 32
 import java.util.Date;
35
-
36 33
 import org.junit.Assert;
37 34
 import org.junit.Test;
38 35
 
39
-import static org.junit.Assert.*;
40
-import static org.mockito.Mockito.*;
36
+import static org.junit.Assert.assertArrayEquals;
37
+import static org.junit.Assert.assertEquals;
38
+import static org.junit.Assert.assertNull;
39
+import static org.junit.Assert.assertTrue;
40
+import static org.mockito.Mockito.any;
41
+import static org.mockito.Mockito.anyInt;
42
+import static org.mockito.Mockito.anyString;
43
+import static org.mockito.Mockito.eq;
44
+import static org.mockito.Mockito.isNull;
45
+import static org.mockito.Mockito.mock;
46
+import static org.mockito.Mockito.verify;
47
+import static org.mockito.Mockito.when;
41 48
 
42 49
 public class IRCReaderTest {
43 50
 
@@ -71,8 +78,8 @@ public class IRCReaderTest {
71 78
         final InputStream stream = new ByteArrayInputStream("te t :foo\r\n".getBytes());
72 79
         final Encoder encoder = mock(Encoder.class);
73 80
 
74
-        when(encoder.encode((String) isNull(), (String) isNull(),
75
-                (byte[]) anyObject(), anyInt(), eq(3)))
81
+        when(encoder.encode(isNull(), isNull(),
82
+                any(), anyInt(), eq(3)))
76 83
                 .thenReturn("encoded");
77 84
 
78 85
         final IRCReader reader = new IRCReader(stream, encoder);
@@ -88,9 +95,7 @@ public class IRCReaderTest {
88 95
         final InputStream stream = new ByteArrayInputStream("foo bar  baz  :qux  baz\r\n".getBytes());
89 96
         final Encoder encoder = mock(Encoder.class);
90 97
 
91
-        when(encoder.encode((String) isNull(), (String) isNull(),
92
-                (byte[]) anyObject(), eq(15), eq(8)))
93
-                .thenReturn("qux  baz");
98
+        when(encoder.encode(isNull(), isNull(), any(), eq(15), eq(8))).thenReturn("qux  baz");
94 99
 
95 100
         final IRCReader reader = new IRCReader(stream, encoder);
96 101
         final ReadLine line = reader.readLine();
@@ -106,8 +111,7 @@ public class IRCReaderTest {
106 111
 
107 112
         new IRCReader(stream, encoder).readLine();
108 113
 
109
-        verify(encoder).encode(eq("src"), anyString(),
110
-                (byte[]) anyObject(), anyInt(), anyInt());
114
+        verify(encoder).encode(eq("src"), isNull(), any(), anyInt(), anyInt());
111 115
     }
112 116
 
113 117
     /** Verifies that no source is passed if the source is empty. */
@@ -118,8 +122,7 @@ public class IRCReaderTest {
118 122
 
119 123
         new IRCReader(stream, encoder).readLine();
120 124
 
121
-        verify(encoder).encode((String) isNull(), anyString(),
122
-                (byte[]) anyObject(), anyInt(), anyInt());
125
+        verify(encoder).encode(isNull(), isNull(), any(), anyInt(), anyInt());
123 126
     }
124 127
 
125 128
     /** Verifies that a destination is extracted properly. */
@@ -130,8 +133,7 @@ public class IRCReaderTest {
130 133
 
131 134
         new IRCReader(stream, encoder).readLine();
132 135
 
133
-        verify(encoder).encode(anyString(), eq("y"), (byte[]) anyObject(),
134
-                anyInt(), anyInt());
136
+        verify(encoder).encode(anyString(), eq("y"), any(), anyInt(), anyInt());
135 137
     }
136 138
 
137 139
     /** Verifies that no destination is extracted if there's no source. */
@@ -142,8 +144,7 @@ public class IRCReaderTest {
142 144
 
143 145
         new IRCReader(stream, encoder).readLine();
144 146
 
145
-        verify(encoder).encode(anyString(), (String) isNull(),
146
-                (byte[]) anyObject(), anyInt(), anyInt());
147
+        verify(encoder).encode(isNull(), isNull(), any(), anyInt(), anyInt());
147 148
     }
148 149
 
149 150
     /** Verifies that no destination is extracted if there are too few args. */
@@ -154,8 +155,7 @@ public class IRCReaderTest {
154 155
 
155 156
         new IRCReader(stream, encoder).readLine();
156 157
 
157
-        verify(encoder).encode(anyString(), (String) isNull(),
158
-                (byte[]) anyObject(), anyInt(), anyInt());
158
+        verify(encoder).encode(anyString(), isNull(), any(), anyInt(), anyInt());
159 159
     }
160 160
 
161 161
     /** Verifies that a numeric's destination is extracted properly. */
@@ -166,7 +166,7 @@ public class IRCReaderTest {
166 166
 
167 167
         new IRCReader(stream, encoder).readLine();
168 168
 
169
-        verify(encoder).encode(anyString(), eq("y"), (byte[]) anyObject(), anyInt(), anyInt());
169
+        verify(encoder).encode(anyString(), eq("y"), any(), anyInt(), anyInt());
170 170
     }
171 171
 
172 172
     /** Verifies that the close call is proxied to the stream. */
@@ -190,8 +190,7 @@ public class IRCReaderTest {
190 190
                 (int) '1', (int) ' ', 0xF6, (int) ' ', (int) 'y', (int) ' ', (int) 'z', (int) ' ',
191 191
                 (int) ':', (int) 'x', (int) '\r', (int) '\n');
192 192
 
193
-        when(encoder.encode(anyString(), anyString(),
194
-                (byte[]) any(), anyInt(), anyInt())).thenReturn("x");
193
+        when(encoder.encode(anyString(), anyString(), any(), anyInt(), anyInt())).thenReturn("x");
195 194
 
196 195
         final ReadLine line = new IRCReader(stream, encoder, Charset.forName("UTF-8")).readLine();
197 196
 

+ 5
- 5
irc/src/test/java/com/dmdirc/parser/irc/processors/Process001Test.java Näytä tiedosto

@@ -36,10 +36,10 @@ import org.mockito.runners.MockitoJUnitRunner;
36 36
 import static org.junit.Assert.assertEquals;
37 37
 import static org.junit.Assert.assertTrue;
38 38
 import static org.junit.Assume.assumeFalse;
39
-import static org.mockito.Matchers.any;
40
-import static org.mockito.Matchers.anyBoolean;
41
-import static org.mockito.Matchers.anyString;
42
-import static org.mockito.Matchers.eq;
39
+import static org.mockito.ArgumentMatchers.any;
40
+import static org.mockito.ArgumentMatchers.anyBoolean;
41
+import static org.mockito.ArgumentMatchers.anyString;
42
+import static org.mockito.ArgumentMatchers.eq;
43 43
 import static org.mockito.Mockito.doAnswer;
44 44
 import static org.mockito.Mockito.mock;
45 45
 import static org.mockito.Mockito.never;
@@ -129,7 +129,7 @@ public class Process001Test {
129 129
         when(localClient.getNickname()).thenAnswer(invocation -> nickname.toString());
130 130
         doAnswer(invocation -> {
131 131
             nickname.setLength(0);
132
-            nickname.append(invocation.getArgumentAt(0, String.class));
132
+            nickname.append(invocation.<String>getArgument(0));
133 133
             return null;
134 134
         }).when(localClient).setUserBits(anyString(), eq(true), anyBoolean());
135 135
     }

+ 0
- 5
xmpp/src/main/java/com/dmdirc/parser/xmpp/XmppProtocolDescription.java Näytä tiedosto

@@ -31,11 +31,6 @@ import java.net.URI;
31 31
  */
32 32
 public class XmppProtocolDescription implements ProtocolDescription {
33 33
 
34
-    @Override
35
-    public int getDefaultPort() {
36
-        return 5222;
37
-    }
38
-
39 34
     @Override
40 35
     public String[] parseHostmask(final String hostmask) {
41 36
         final String[] parts = hostmask.split("/");

Loading…
Peruuta
Tallenna