mminor modification

This commit is contained in:
2015-07-06 00:25:15 +02:00
parent 2e44e41628
commit 77387d9523
10 changed files with 65 additions and 95 deletions

View File

@@ -124,6 +124,7 @@ public class PacmanWebService
{
output.write(bytes);
}
output.close();
}
catch (Exception e)
{
@@ -131,7 +132,6 @@ public class PacmanWebService
}
finally
{
output.close();
input.close();
}
};

View File

@@ -6,8 +6,10 @@ import org.jpacrepo.model.PkgData;
import org.jpacrepo.pacbase.Hasher;
import org.jpacrepo.pacbase.MD5InputStream;
import org.jpacrepo.pacbase.Parser;
import org.jpacrepo.service.PacmanService;
import org.junit.Test;
import javax.naming.*;
import javax.ws.rs.client.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@@ -19,6 +21,7 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.util.Properties;
/**
* Created by walter on 29/03/15.
@@ -99,4 +102,47 @@ public class ClientTest
}
}
private static void traverseJndiNode(String nodeName, Context context)
{
try
{
NamingEnumeration<NameClassPair> list = context.list(nodeName);
while (list.hasMore())
{
String childName = nodeName + "" + list.next().getName();
System.out.println(childName);
traverseJndiNode(childName, context);
}
} catch (NamingException ex)
{
// We reached a leaf
}
}
@Test
public void invokeStatelessBean() throws Exception
{
// Let's lookup the remote stateless calculator
Properties prop = new Properties();
InputStream in = getClass().getClassLoader().getResourceAsStream("jboss-ejb-client.properties");
prop.load(in);
prop.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
// prop.put(Context.PROVIDER_URL, "http-remoting://localhost:8080");
prop.put(Context.PROVIDER_URL, "http-remoting://odroid-u3:8080");
// prop.put(Context.PROVIDER_URL, "remote://odroid-u3:4447");
prop.put(Context.SECURITY_PRINCIPAL, "jpacrepo");
prop.put(Context.SECURITY_CREDENTIALS, "password01.");
prop.put("jboss.naming.client.ejb.context", true);
Context context = new InitialContext(prop);
Context ctx = new InitialContext(prop);
traverseJndiNode("/", context);
// final PacmanService stateService = (PacmanService) ctx.lookup("/jpacrepo-1.0/remote/PacmanServiceEJB!service.PacmanService");
final PacmanService stateService = (PacmanService) ctx.lookup("/jpacrepo/PacmanServiceEJB!org.jpacrepo.service.PacmanService");
stateService.deletePackage("google-earth-7.1.4.1529-1-x86_64.pkg.tar.xz");
}
}