ID -> Id (#393 Ensure all fields follow our naming convention)

This commit is contained in:
Trustin Lee 2012-06-12 20:20:24 +09:00
parent 676b81a4cd
commit 154198a385
7 changed files with 42 additions and 42 deletions

View File

@ -23,8 +23,8 @@ import io.netty.util.internal.StringUtil;
public class DefaultSpdySynStreamFrame extends DefaultSpdyHeaderBlock
implements SpdySynStreamFrame {
private int streamID;
private int associatedToStreamID;
private int streamId;
private int associatedToStreamId;
private byte priority;
private boolean last;
private boolean unidirectional;
@ -32,44 +32,44 @@ public class DefaultSpdySynStreamFrame extends DefaultSpdyHeaderBlock
/**
* Creates a new instance.
*
* @param streamID the Stream-ID of this frame
* @param associatedToStreamID the Associated-To-Stream-ID of this frame
* @param streamId the Stream-ID of this frame
* @param associatedToStreamId the Associated-To-Stream-ID of this frame
* @param priority the priority of the stream
*/
public DefaultSpdySynStreamFrame(
int streamID, int associatedToStreamID, byte priority) {
setStreamID(streamID);
setAssociatedToStreamID(associatedToStreamID);
int streamId, int associatedToStreamId, byte priority) {
setStreamId(streamId);
setAssociatedToStreamId(associatedToStreamId);
setPriority(priority);
}
@Override
public int getStreamID() {
return streamID;
public int getStreamId() {
return streamId;
}
@Override
public void setStreamID(int streamID) {
if (streamID <= 0) {
public void setStreamId(int streamId) {
if (streamId <= 0) {
throw new IllegalArgumentException(
"Stream-ID must be positive: " + streamID);
"Stream-ID must be positive: " + streamId);
}
this.streamID = streamID;
this.streamId = streamId;
}
@Override
public int getAssociatedToStreamID() {
return associatedToStreamID;
public int getAssociatedToStreamId() {
return associatedToStreamId;
}
@Override
public void setAssociatedToStreamID(int associatedToStreamID) {
if (associatedToStreamID < 0) {
public void setAssociatedToStreamId(int associatedToStreamId) {
if (associatedToStreamId < 0) {
throw new IllegalArgumentException(
"Associated-To-Stream-ID cannot be negative: " +
associatedToStreamID);
associatedToStreamId);
}
this.associatedToStreamID = associatedToStreamID;
this.associatedToStreamId = associatedToStreamId;
}
@Override
@ -117,11 +117,11 @@ public class DefaultSpdySynStreamFrame extends DefaultSpdyHeaderBlock
buf.append(')');
buf.append(StringUtil.NEWLINE);
buf.append("--> Stream-ID = ");
buf.append(streamID);
buf.append(streamId);
buf.append(StringUtil.NEWLINE);
if (associatedToStreamID != 0) {
if (associatedToStreamId != 0) {
buf.append("--> Associated-To-Stream-ID = ");
buf.append(associatedToStreamID);
buf.append(associatedToStreamId);
buf.append(StringUtil.NEWLINE);
}
buf.append("--> Priority = ");

View File

@ -122,8 +122,8 @@ public class SpdyFrameEncoder extends MessageToByteEncoder<Object> {
out.writeShort(SPDY_SYN_STREAM_FRAME);
out.writeByte(flags);
out.writeMedium(length);
out.writeInt(spdySynStreamFrame.getStreamID());
out.writeInt(spdySynStreamFrame.getAssociatedToStreamID());
out.writeInt(spdySynStreamFrame.getStreamId());
out.writeInt(spdySynStreamFrame.getAssociatedToStreamId());
if (version < 3) {
// Restrict priorities for SPDY/2 to between 0 and 3
byte priority = spdySynStreamFrame.getPriority();

View File

@ -70,11 +70,11 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<Object, HttpMessage
// HTTP requests/responses are mapped one-to-one to SPDY streams.
SpdySynStreamFrame spdySynStreamFrame = (SpdySynStreamFrame) msg;
int streamID = spdySynStreamFrame.getStreamID();
int streamID = spdySynStreamFrame.getStreamId();
if (SpdyCodecUtil.isServerID(streamID)) {
// SYN_STREAM frames initiated by the server are pushed resources
int associatedToStreamID = spdySynStreamFrame.getAssociatedToStreamID();
int associatedToStreamID = spdySynStreamFrame.getAssociatedToStreamId();
// If a client receives a SYN_STREAM with an Associated-To-Stream-ID of 0
// it must reply with a RST_STREAM with error code INVALID_STREAM

View File

@ -151,7 +151,7 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
HttpRequest httpRequest = (HttpRequest) msg;
SpdySynStreamFrame spdySynStreamFrame = createSynStreamFrame(httpRequest);
int streamID = spdySynStreamFrame.getStreamID();
int streamID = spdySynStreamFrame.getStreamId();
out.add(spdySynStreamFrame);
addContent(out, streamID, httpRequest);
@ -160,7 +160,7 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
HttpResponse httpResponse = (HttpResponse) msg;
if (httpResponse.containsHeader(SpdyHttpHeaders.Names.ASSOCIATED_TO_STREAM_ID)) {
SpdySynStreamFrame spdySynStreamFrame = createSynStreamFrame(httpResponse);
int streamID = spdySynStreamFrame.getStreamID();
int streamID = spdySynStreamFrame.getStreamId();
out.add(spdySynStreamFrame);
addContent(out, streamID, httpResponse);
} else {

View File

@ -236,7 +236,7 @@ public class SpdySessionHandler
*/
SpdySynStreamFrame spdySynStreamFrame = (SpdySynStreamFrame) msg;
int streamID = spdySynStreamFrame.getStreamID();
int streamID = spdySynStreamFrame.getStreamId();
// Check if we received a valid SYN_STREAM frame
if (spdySynStreamFrame.isInvalid() ||
@ -564,7 +564,7 @@ public class SpdySessionHandler
} else if (msg instanceof SpdySynStreamFrame) {
SpdySynStreamFrame spdySynStreamFrame = (SpdySynStreamFrame) msg;
int streamID = spdySynStreamFrame.getStreamID();
int streamID = spdySynStreamFrame.getStreamId();
if (isRemoteInitiatedID(streamID)) {
ctx.fireExceptionCaught(PROTOCOL_EXCEPTION);

View File

@ -23,23 +23,23 @@ public interface SpdySynStreamFrame extends SpdyHeaderBlock {
/**
* Returns the Stream-ID of this frame.
*/
int getStreamID();
int getStreamId();
/**
* Sets the Stream-ID of this frame. The Stream-ID must be positive.
*/
void setStreamID(int streamID);
void setStreamId(int streamId);
/**
* Returns the Associated-To-Stream-ID of this frame.
*/
int getAssociatedToStreamID();
int getAssociatedToStreamId();
/**
* Sets the Associated-To-Stream-ID of this frame.
* The Associated-To-Stream-ID cannot be negative.
*/
void setAssociatedToStreamID(int associatedToStreamID);
void setAssociatedToStreamId(int associatedToStreamId);
/**
* Returns the priority of the stream.

View File

@ -156,7 +156,7 @@ public class SpdySessionHandlerTest {
// Check if session handler closed the streams using the number
// of concurrent streams and that it returns REFUSED_STREAM
// if it receives a SYN_STREAM frame it does not wish to accept
spdySynStreamFrame.setStreamID(localStreamID);
spdySynStreamFrame.setStreamId(localStreamID);
spdySynStreamFrame.setLast(true);
spdySynStreamFrame.setUnidirectional(true);
sessionHandler.writeInbound(spdySynStreamFrame);
@ -184,11 +184,11 @@ public class SpdySessionHandlerTest {
// Check if session handler returns PROTOCOL_ERROR if it receives
// a SYN_STREAM frame with an invalid Stream-ID
spdySynStreamFrame.setStreamID(localStreamID - 1);
spdySynStreamFrame.setStreamId(localStreamID - 1);
sessionHandler.writeInbound(spdySynStreamFrame);
assertRstStream(sessionHandler.readOutbound(), localStreamID - 1, SpdyStreamStatus.PROTOCOL_ERROR);
Assert.assertNull(sessionHandler.readOutbound());
spdySynStreamFrame.setStreamID(localStreamID);
spdySynStreamFrame.setStreamId(localStreamID);
// Check if session handler correctly limits the number of
// concurrent streams in the SETTINGS frame
@ -241,7 +241,7 @@ public class SpdySessionHandlerTest {
// Check if session handler returns REFUSED_STREAM if it receives
// SYN_STREAM frames after sending a GOAWAY frame
spdySynStreamFrame.setStreamID(localStreamID);
spdySynStreamFrame.setStreamId(localStreamID);
sessionHandler.writeInbound(spdySynStreamFrame);
assertRstStream(sessionHandler.readOutbound(), localStreamID, SpdyStreamStatus.REFUSED_STREAM);
Assert.assertNull(sessionHandler.readOutbound());
@ -290,11 +290,11 @@ public class SpdySessionHandlerTest {
new DefaultSpdySynStreamFrame(streamID, 0, (byte) 0);
spdySynStreamFrame.setLast(true);
ctx.write(spdySynStreamFrame);
spdySynStreamFrame.setStreamID(spdySynStreamFrame.getStreamID() + 2);
spdySynStreamFrame.setStreamId(spdySynStreamFrame.getStreamId() + 2);
ctx.write(spdySynStreamFrame);
spdySynStreamFrame.setStreamID(spdySynStreamFrame.getStreamID() + 2);
spdySynStreamFrame.setStreamId(spdySynStreamFrame.getStreamId() + 2);
ctx.write(spdySynStreamFrame);
spdySynStreamFrame.setStreamID(spdySynStreamFrame.getStreamID() + 2);
spdySynStreamFrame.setStreamId(spdySynStreamFrame.getStreamId() + 2);
ctx.write(spdySynStreamFrame);
// Limit the number of concurrent streams to 3
@ -317,7 +317,7 @@ public class SpdySessionHandlerTest {
SpdySynStreamFrame spdySynStreamFrame = (SpdySynStreamFrame) msg;
if (!spdySynStreamFrame.isUnidirectional()) {
int streamID = spdySynStreamFrame.getStreamID();
int streamID = spdySynStreamFrame.getStreamId();
SpdySynReplyFrame spdySynReplyFrame = new DefaultSpdySynReplyFrame(streamID);
spdySynReplyFrame.setLast(spdySynStreamFrame.isLast());
for (Map.Entry<String, String> entry: spdySynStreamFrame.getHeaders()) {