@Test public void createGetMethodNoHttpParams() throws URIException { final GetMethod get = manager.createGetMethod( "http://sourceforge.net/", new HashMap<String, HttpParamInfo>(), CHARSET, false); assertEquals("Unexpected URI created", "http://sourceforge.net/", get.getURI().getURI()); }
@Override protected void updateContext(final ProxyRepository repository, final RemoteStorageContext ctx) throws RemoteStorageException { // reset current http client, if exists ctx.removeContextObject(CTX_KEY_CLIENT); ctx.removeContextObject(CTX_KEY_S3_FLAG); httpClientManager.release(repository, ctx); try { // and create a new one final HttpClient httpClient = httpClientManager.create(repository, ctx); ctx.putContextObject(CTX_KEY_CLIENT, httpClient); // NEXUS-3338: we don't know after config change is remote S3 (url changed maybe) ctx.putContextObject(CTX_KEY_S3_FLAG, new BooleanFlagHolder()); } catch (IllegalStateException e) { throw new RemoteStorageException("Could not create HTTPClient4x instance!", e); } }
@Test public void createGetMethodWithHttpParams() throws URIException { final Map<String, HttpParamInfo> params = new LinkedHashMap<String, HttpParamInfo>(); params.put( "param1", new HttpParamInfo("param1", false, null, null, new NodeVariable("param1Value"))); params.put( "param2", new HttpParamInfo("param2", false, null, null, new NodeVariable("param2Value"))); final GetMethod get = manager.createGetMethod("http://sourceforge.net/", params, CHARSET, false); assertEquals( "Unexpected URI created", "http://sourceforge.net/?param1=param1Value¶m2=param2Value", get.getURI().getURI()); }