Return-Path: X-Original-To: apmail-geode-issues-archive@minotaur.apache.org Delivered-To: apmail-geode-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1E1F818EE1 for ; Wed, 16 Dec 2015 00:18:02 +0000 (UTC) Received: (qmail 9530 invoked by uid 500); 16 Dec 2015 00:18:02 -0000 Delivered-To: apmail-geode-issues-archive@geode.apache.org Received: (qmail 9496 invoked by uid 500); 16 Dec 2015 00:18:02 -0000 Mailing-List: contact issues-help@geode.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.incubator.apache.org Delivered-To: mailing list issues@geode.incubator.apache.org Received: (qmail 9486 invoked by uid 99); 16 Dec 2015 00:18:02 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Dec 2015 00:18:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 8E8AAC28EA for ; Wed, 16 Dec 2015 00:18:01 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.991 X-Spam-Level: X-Spam-Status: No, score=0.991 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id luK33mXmNySw for ; Wed, 16 Dec 2015 00:17:47 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id DF72226AD4 for ; Wed, 16 Dec 2015 00:17:46 +0000 (UTC) Received: (qmail 8827 invoked by uid 99); 16 Dec 2015 00:17:46 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Dec 2015 00:17:46 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 9FE722C0AFA for ; Wed, 16 Dec 2015 00:17:46 +0000 (UTC) Date: Wed, 16 Dec 2015 00:17:46 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@geode.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (GEODE-651) Chunk classes need unit tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/GEODE-651?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15059168#comment-15059168 ] ASF GitHub Bot commented on GEODE-651: -------------------------------------- Github user dschneider-pivotal commented on a diff in the pull request: https://github.com/apache/incubator-geode/pull/60#discussion_r47719822 --- Diff: gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/GemFireChunkFactoryJUnitTest.java --- @@ -0,0 +1,138 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.gemstone.gemfire.internal.offheap; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.mock; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import com.gemstone.gemfire.LogWriter; +import com.gemstone.gemfire.internal.cache.EntryEventImpl; +import com.gemstone.gemfire.test.junit.categories.UnitTest; + +@Category(UnitTest.class) +public class GemFireChunkFactoryJUnitTest { + + private MemoryAllocator ma; + + @Before + public void setUp() { + OutOfOffHeapMemoryListener ooohml = mock(OutOfOffHeapMemoryListener.class); + OffHeapMemoryStats stats = mock(OffHeapMemoryStats.class); + LogWriter lw = mock(LogWriter.class); + + ma = SimpleMemoryAllocatorImpl.create(ooohml, stats, lw, 1, OffHeapStorage.MIN_SLAB_SIZE * 1, OffHeapStorage.MIN_SLAB_SIZE); + } + + @After + public void tearDown() { + SimpleMemoryAllocatorImpl.freeOffHeapMemory(); + } + + private GemFireChunk createChunk(Object value) { + byte[] v = EntryEventImpl.serialize(value); + + boolean isSerialized = true; + boolean isCompressed = false; + + GemFireChunk chunk = (GemFireChunk) ma.allocateAndInitialize(v, isSerialized, isCompressed, GemFireChunk.TYPE); + chunk.setSerializedValue(v); --- End diff -- remove the calls to setSerializedValue, setSerialized and setCompressed since allocateAndInitialize call them > Chunk classes need unit tests > ----------------------------- > > Key: GEODE-651 > URL: https://issues.apache.org/jira/browse/GEODE-651 > Project: Geode > Issue Type: Sub-task > Components: offheap > Reporter: Sai Boorlagadda > Assignee: Sai Boorlagadda > > Chunk and its subclasses (GemFireChunk, ChunkWithHeapForm, and GemFireChunkSlice) need unit tests. > GemFireChunkFactory needs a unit test. -- This message was sent by Atlassian JIRA (v6.3.4#6332)