#6327 extract HttpOutput._apiState value from toString

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
Ludovic Orban 2021-08-02 13:04:44 +02:00
parent 26d144d708
commit 5dc856196e
3 changed files with 2 additions and 31 deletions

View File

@ -1516,12 +1516,6 @@ public class HttpOutput extends ServletOutputStream implements Runnable
}
}
// For testing
ApiState getApiState()
{
return _apiState;
}
private String stateString()
{
return String.format("s=%s,api=%s,sc=%b,e=%s", _state, _apiState, _softClose, _onError);

View File

@ -68,8 +68,6 @@ import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.HttpChannel;
import org.eclipse.jetty.server.HttpInput;
import org.eclipse.jetty.server.HttpInput.Content;
import org.eclipse.jetty.server.HttpOutput;
import org.eclipse.jetty.server.HttpOutputHelper;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandler.Context;
@ -437,7 +435,8 @@ public class AsyncIOServletTest extends AbstractTest<AsyncIOServletTest.AsyncTra
Await.await().atMost(5, TimeUnit.SECONDS).until(() ->
{
out.write(new byte[0]);
return !HttpOutputHelper.getApiState(((HttpOutput)out)).equals("READY");
// Extract HttpOutput._apiState value from toString.
return !out.toString().split(",")[1].split("=")[1].equals("READY");
});
}
catch (Exception e)

View File

@ -1,22 +0,0 @@
//
// ========================================================================
// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
// ========================================================================
//
package org.eclipse.jetty.server;
public class HttpOutputHelper
{
public static String getApiState(HttpOutput httpOutput)
{
return httpOutput.getApiState().toString();
}
}