You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "jon (Created) (JIRA)" <ji...@apache.org> on 2012/03/26 16:26:28 UTC
[jira] [Created] (KAFKA-319) compression support added to php
client does not pass unit tests
compression support added to php client does not pass unit tests
----------------------------------------------------------------
Key: KAFKA-319
URL: https://issues.apache.org/jira/browse/KAFKA-319
Project: Kafka
Issue Type: Bug
Components: clients
Affects Versions: 0.7
Reporter: jon
Priority: Trivial
The fix from #KAFKA-159 breaks unit tests. The client has changed to expect a compression algo.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (KAFKA-319) compression support added to php
client does not pass unit tests
Posted by "jon (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-319?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
jon updated KAFKA-319:
----------------------
Status: Patch Available (was: Open)
diff --git a/clients/php/src/lib/Kafka/Encoder.php b/clients/php/src/lib/Kafka/Encoder.php
index 3c05cfd..edc8258 100644
--- a/clients/php/src/lib/Kafka/Encoder.php
+++ b/clients/php/src/lib/Kafka/Encoder.php
@@ -40,7 +40,7 @@ class Kafka_Encoder
*
* @return string
*/
- static public function encode_message($msg, $compression) {
+ static public function encode_message($msg, $compression=0) {
// <MAGIC_BYTE: 1 byte> <COMPRESSION: 1 byte> <CRC32: 4 bytes bigendian> <PAYLOAD: N bytes>
return pack('CCN', self::CURRENT_MAGIC_VALUE, $compression, crc32($msg))
. $msg;
@@ -56,7 +56,7 @@ class Kafka_Encoder
*
* @return string
*/
- static public function encode_produce_request($topic, $partition, array $messages, $compression) {
+ static public function encode_produce_request($topic, $partition, array $messages, $compression=0) {
// encode messages as <LEN: int><MESSAGE_BYTES>
$message_set = '';
foreach ($messages as $message) {
diff --git a/clients/php/src/tests/Kafka/BoundedByteBuffer/ReceiveTest.php b/clients/php/src/tests/Kafka/BoundedByteBuffer/ReceiveTest.php
index a751d7e..480bd4d 100644
--- a/clients/php/src/tests/Kafka/BoundedByteBuffer/ReceiveTest.php
+++ b/clients/php/src/tests/Kafka/BoundedByteBuffer/ReceiveTest.php
@@ -1,3 +1,4 @@
+<?php
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +16,7 @@
* limitations under the License.
*/
-<?php
+
if (!defined('PRODUCE_REQUEST_ID')) {
define('PRODUCE_REQUEST_ID', 0);
}
diff --git a/clients/php/src/tests/Kafka/BoundedByteBuffer/SendTest.php b/clients/php/src/tests/Kafka/BoundedByteBuffer/SendTest.php
index 72c8f30..509a4c6 100644
--- a/clients/php/src/tests/Kafka/BoundedByteBuffer/SendTest.php
+++ b/clients/php/src/tests/Kafka/BoundedByteBuffer/SendTest.php
@@ -1,3 +1,4 @@
+<?php
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +16,6 @@
* limitations under the License.
*/
-<?php
/**
* Description of Kafka_BoundedByteBuffer_SendTest
diff --git a/clients/php/src/tests/Kafka/EncoderTest.php b/clients/php/src/tests/Kafka/EncoderTest.php
index 628b05f..471d31c 100644
--- a/clients/php/src/tests/Kafka/EncoderTest.php
+++ b/clients/php/src/tests/Kafka/EncoderTest.php
@@ -1,3 +1,4 @@
+<?php
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -14,8 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-<?php
if (!defined('PRODUCE_REQUEST_ID')) {
define('PRODUCE_REQUEST_ID', 0);
}
@@ -30,7 +29,7 @@ class Kafka_EncoderTest extends PHPUnit_Framework_TestCase
public function testEncodedMessageLength() {
$test = 'a sample string';
$encoded = Kafka_Encoder::encode_message($test);
- $this->assertEquals(5 + strlen($test), strlen($encoded));
+ $this->assertEquals(6 + strlen($test), strlen($encoded));
}
public function testByteArrayContainsString() {
@@ -54,7 +53,7 @@ class Kafka_EncoderTest extends PHPUnit_Framework_TestCase
}
$size = 4 + 2 + 2 + strlen($topic) + 4 + 4;
foreach ($messages as $msg) {
- $size += 9 + strlen($msg);
+ $size += 10 + strlen($msg);
}
$this->assertEquals($size, strlen($encoded));
}
diff --git a/clients/php/src/tests/Kafka/FetchRequestTest.php b/clients/php/src/tests/Kafka/FetchRequestTest.php
index ce3f274..408309d 100644
--- a/clients/php/src/tests/Kafka/FetchRequestTest.php
+++ b/clients/php/src/tests/Kafka/FetchRequestTest.php
@@ -1,3 +1,4 @@
+<?php
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -15,8 +16,6 @@
* limitations under the License.
*/
-<?php
-
/**
* Description of FetchRequestTest
*
@@ -85,4 +84,4 @@ class Kafka_FetchRequestTest extends PHPUnit_Framework_TestCase
$this->assertContains('offset:' . $this->offset, (string)$this->req);
$this->assertContains('maxSize:' . $this->maxSize, (string)$this->req);
}
-}
\ No newline at end of file
+}
diff --git a/clients/php/src/tests/Kafka/MessageTest.php b/clients/php/src/tests/Kafka/MessageTest.php
index 38c3cc6..eed94ef 100644
--- a/clients/php/src/tests/Kafka/MessageTest.php
+++ b/clients/php/src/tests/Kafka/MessageTest.php
@@ -1,3 +1,4 @@
+<?php
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +16,6 @@
* limitations under the License.
*/
-<?php
/**
* @author Lorenzo Alberton <l....@quipo.it>
diff --git a/clients/php/src/tests/Kafka/ProducerTest.php b/clients/php/src/tests/Kafka/ProducerTest.php
index a6705fa..c25a96e 100644
--- a/clients/php/src/tests/Kafka/ProducerTest.php
+++ b/clients/php/src/tests/Kafka/ProducerTest.php
@@ -1,3 +1,4 @@
+<?php
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +16,6 @@
* limitations under the License.
*/
-<?php
/**
* Override connect() method of base class
diff --git a/clients/php/src/tests/bootstrap.php b/clients/php/src/tests/bootstrap.php
index cbeb8cc..1681cc1 100644
--- a/clients/php/src/tests/bootstrap.php
+++ b/clients/php/src/tests/bootstrap.php
@@ -1,3 +1,4 @@
+<?php
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +16,6 @@
* limitations under the License.
*/
-<?php
function test_autoload($className)
{
@@ -50,4 +50,4 @@ set_include_path(
);
date_default_timezone_set('Europe/London');
-
\ No newline at end of file
+
--
1.7.4.1
> compression support added to php client does not pass unit tests
> ----------------------------------------------------------------
>
> Key: KAFKA-319
> URL: https://issues.apache.org/jira/browse/KAFKA-319
> Project: Kafka
> Issue Type: Bug
> Components: clients
> Affects Versions: 0.7
> Reporter: jon
> Priority: Trivial
>
> The fix from #KAFKA-159 breaks unit tests. The client has changed to expect a compression algo.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (KAFKA-319) compression support added to php
client does not pass unit tests
Posted by "Lorenzo Alberton (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-319?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13423236#comment-13423236 ]
Lorenzo Alberton commented on KAFKA-319:
----------------------------------------
Patch superseded by KAFKA-419
> compression support added to php client does not pass unit tests
> ----------------------------------------------------------------
>
> Key: KAFKA-319
> URL: https://issues.apache.org/jira/browse/KAFKA-319
> Project: Kafka
> Issue Type: Bug
> Components: clients
> Affects Versions: 0.7
> Reporter: jon
> Priority: Trivial
>
> The fix from #KAFKA-159 breaks unit tests. The client has changed to expect a compression algo.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira