package org.opennms.netmgt.discovery.messages;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.net.InetAddress;
import java.util.List;
import java.util.Map;

import org.junit.Test;
import org.opennms.netmgt.discovery.messages.DiscoveryJob;
import org.opennms.netmgt.discovery.messages.DiscoveryResults;
import org.opennms.netmgt.model.discovery.IPPollRange;

import com.google.common.base.Throwables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

public class MessageSerializationTest {

    @Test
    public void canSerializeJob() throws IOException {
        IPPollRange range = new IPPollRange("4.2.2.2", "4.2.2.2", 1, 1);
        List<IPPollRange> ranges = Lists.newArrayList(range);
        DiscoveryJob job = new DiscoveryJob(ranges, "x", "y");
        serialize(job);
    }

    @Test
    public void canSerializeResults() throws IOException {
        Map<InetAddress, Long> responses = Maps.newConcurrentMap();
        responses.put(InetAddress.getByName("4.2.2.2"), 1L);
        DiscoveryResults results = new DiscoveryResults(responses, "x", "y");
        serialize(results);
    }

    private static void serialize(Object o) {
        try {
            ObjectOutputStream out = new ObjectOutputStream(new ByteArrayOutputStream());
            out.writeObject(o);
            out.close();
        } catch (Throwable t) {
            throw Throwables.propagate(t);
        }
    }
}

@@ -175,31 +175,8 @@
 ss;%0A
-import java.util.List;%0A
 impo
@@ -221,67 +221,8 @@
 st;%0A
-import org.opennms.netmgt.discovery.messages.DiscoveryJob;%0A
 impo
@@ -283,63 +283,8 @@
 lts;
-%0Aimport org.opennms.netmgt.model.discovery.IPPollRange;
 %0A%0Aim
@@ -327,48 +327,8 @@
 es;%0A
-import com.google.common.collect.Lists;%0A
 impo
@@ -404,16 +404,23 @@
 Test %7B%0A%0A
+    /*%0A
     @Tes
@@ -699,24 +699,31 @@
 (job);%0A    %7D
+%0A    */
 %0A%0A    @Test%0A

Fix compile error.