Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes #39

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
*/
package de.uzl.itm.ncoap.application;

import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import de.uzl.itm.ncoap.communication.AbstractCoapChannelHandler;
import org.jboss.netty.bootstrap.ConnectionlessBootstrap;
Expand All @@ -34,7 +33,6 @@
import org.jboss.netty.channel.FixedReceiveBufferSizePredictor;
import org.jboss.netty.channel.socket.DatagramChannel;
import org.jboss.netty.channel.socket.nio.NioDatagramChannelFactory;
import org.jboss.netty.channel.socket.oio.OioDatagramChannelFactory;
import org.jboss.netty.util.ThreadNameDeterminer;
import org.jboss.netty.util.ThreadRenamingRunnable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@

import de.uzl.itm.ncoap.communication.blockwise.BlockSize;
import de.uzl.itm.ncoap.message.CoapResponse;
import org.jboss.netty.buffer.ChannelBuffer;
import de.uzl.itm.ncoap.message.options.Option;

import java.net.InetSocketAddress;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
package de.uzl.itm.ncoap.application.client;

import de.uzl.itm.ncoap.application.AbstractCoapApplication;
import de.uzl.itm.ncoap.communication.blockwise.BlockSize;
import de.uzl.itm.ncoap.communication.dispatching.client.ResponseDispatcher;
import de.uzl.itm.ncoap.message.CoapMessage;
import de.uzl.itm.ncoap.message.CoapRequest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ public CoapEndpoint() {
BlockSize.UNBOUND);
}

/**
* <p>Creates a new instance of {@link CoapEndpoint}. See {@link #CoapEndpoint()} for default values of
* unspecified parameters).</p>
*
* @param maxBlock1Size the maximum blocksize for inbound requests
* @param maxBlock2Size the maximum blocksize for outbound responses
*/
public CoapEndpoint(BlockSize maxBlock1Size, BlockSize maxBlock2Size) {
this(DEFAULT_NAME, NotFoundHandler.getDefault(), CoapServer.getDefaultSocket(), maxBlock1Size, maxBlock2Size);
}

/**
* <p>Creates a new instance of {@link de.uzl.itm.ncoap.application.endpoint.CoapEndpoint}</p>
*
Expand Down Expand Up @@ -162,7 +173,7 @@ public CoapEndpoint(String applicationName, NotFoundHandler notFoundHandler, Ine
*
* @param remoteSocket the desired recipient of the given {@link de.uzl.itm.ncoap.message.CoapRequest}
*/
public void sendCoapRequest(CoapRequest coapRequest, ClientCallback callback, InetSocketAddress remoteSocket) {
public void sendCoapRequest(CoapRequest coapRequest, InetSocketAddress remoteSocket, ClientCallback callback) {
this.responseDispatcher.sendCoapRequest(coapRequest, remoteSocket, callback);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import com.google.common.primitives.Ints;
import com.google.common.util.concurrent.SettableFuture;
import de.uzl.itm.ncoap.application.linkformat.LinkParam;
import de.uzl.itm.ncoap.application.linkformat.LinkValue;
import de.uzl.itm.ncoap.application.linkformat.LinkValueList;
import de.uzl.itm.ncoap.message.CoapMessage;
import de.uzl.itm.ncoap.message.CoapRequest;
Expand All @@ -39,7 +38,6 @@

import java.net.InetSocketAddress;
import java.util.Arrays;
import java.util.Collection;
import java.util.concurrent.ScheduledExecutorService;

import static de.uzl.itm.ncoap.message.MessageCode.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
*/
package de.uzl.itm.ncoap.communication.blockwise;

import de.uzl.itm.ncoap.message.options.UintOptionValue;
import jdk.nashorn.internal.ir.Block;

/**
* Created by olli on 09.02.16.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
package de.uzl.itm.ncoap;

import org.apache.log4j.*;
import org.junit.BeforeClass;

/**
* Abstract class to be extended by all nCoAP tests to get proper logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import java.nio.charset.Charset;
import java.util.Iterator;

import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertEquals;

/**
* Tests if a client receives notifications.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import de.uzl.itm.ncoap.message.MessageType;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.Ignore;
import org.junit.Test;

import java.net.InetSocketAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
import java.nio.charset.Charset;
import java.util.SortedMap;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.*;

/**
* Tests to verify the server functionality related to piggy-backed responses.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@
import de.uzl.itm.ncoap.message.*;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.Ignore;
import org.junit.Test;

import java.net.InetSocketAddress;
import java.net.URI;

import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertEquals;

/**
* Tests to verify the server functionality related to piggy-backed responses.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import java.net.InetSocketAddress;
import java.net.URI;

import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertEquals;


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import java.net.InetSocketAddress;
import java.net.URI;

import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertEquals;


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import java.net.URI;
import java.util.SortedMap;

import static junit.framework.Assert.*;
import static org.junit.Assert.*;


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void shutdownComponents() throws Exception {
public void createTestScenario() throws Exception {

for(int i = 0; i < NUMBER_OF_PARALLEL_REQUESTS; i++) {
client.sendCoapRequest(requests[i], clientCallbacks[i], serverSocket);
client.sendCoapRequest(requests[i], serverSocket, clientCallbacks[i]);
}

//await responses (10 seconds should more than enough for 100 requests!)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import java.net.URI;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;

/**
* Created by olli on 01.09.15.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import java.net.URI;
import java.nio.charset.Charset;

import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertEquals;

/**
* Tests for the removal of observers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import de.uzl.itm.ncoap.message.CoapResponse;
import de.uzl.itm.ncoap.message.MessageCode;
import de.uzl.itm.ncoap.message.options.ContentFormat;
import de.uzl.itm.ncoap.message.options.OptionValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import static org.junit.Assert.fail;

/**
* This observable resource changes its status periodically with a delay given as argument for the constructor.
* There are 5 possible states. The internal state representation, i.e. the returned value v of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import java.util.List;
import java.util.Set;

import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertEquals;


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
import org.apache.log4j.Logger;
import org.junit.Test;

import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;

import java.net.InetSocketAddress;
import java.net.URI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@
*/
package de.uzl.itm.ncoap.examples.client;

import de.uzl.itm.ncoap.application.client.ClientCallback;
import de.uzl.itm.ncoap.application.client.CoapClient;
import de.uzl.itm.ncoap.communication.blockwise.BlockSize;
import de.uzl.itm.ncoap.examples.client.callback.SimpleCallback;
import de.uzl.itm.ncoap.examples.client.callback.SimpleObservationCallback;
import de.uzl.itm.ncoap.examples.client.config.ClientCmdLineArgumentsWrapper;
import de.uzl.itm.ncoap.examples.client.config.LoggingConfiguration;
import de.uzl.itm.ncoap.message.*;
import de.uzl.itm.ncoap.message.options.ContentFormat;

import java.net.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
import de.uzl.itm.ncoap.communication.blockwise.BlockSize;
import de.uzl.itm.ncoap.message.options.OptionValue;

import java.util.concurrent.ScheduledExecutorService;

/**
* This is a simple application to showcase how to use nCoAP for servers
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@
import static de.uzl.itm.ncoap.application.linkformat.LinkParam.Key.*;
import static de.uzl.itm.ncoap.message.options.ContentFormat.*;

import com.google.common.collect.HashBasedTable;
import com.google.common.primitives.Longs;
import com.google.common.util.concurrent.SettableFuture;
import de.uzl.itm.ncoap.application.linkformat.LinkParam;
import de.uzl.itm.ncoap.application.server.resource.ObservableWebresource;
import de.uzl.itm.ncoap.application.server.resource.WrappedResourceStatus;
import de.uzl.itm.ncoap.communication.dispatching.Token;
import de.uzl.itm.ncoap.message.*;
import de.uzl.itm.ncoap.message.options.ContentFormat;
import org.apache.log4j.Logger;
Expand All @@ -43,7 +41,6 @@
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

/**
Expand Down