Package org.eclipse.jgit.util

Examples of org.eclipse.jgit.util.TemporaryBuffer$Block


    }

    @Test
    public void found_edit_block()
    {
        Block block = mockBlock();
        RequestPageCache cache = mockRequestPageCache();
        Page page = mockPage();
        BeanBlockContribution contribution = new EditBlockContribution("mydata", "MyPage", "mydisplay");
        Collection<BeanBlockContribution> configuration = newList(contribution);

        train_get(cache, "MyPage", page);
        train_getBlock(page, "mydisplay", block);

        replay();

        BeanBlockSource source = new BeanBlockSourceImpl(cache, createBeanBlockOverrideSource(cache), configuration);

        // Check case insensitivity while we are at it.
        Block actual = source.getEditBlock("MyData");

        assertSame(actual, block);

        verify();
    }
View Full Code Here


    }

    @Test
    public void found_edit_block_in_override()
    {
        Block block = mockBlock();
        RequestPageCache cache = mockRequestPageCache();
        BeanBlockOverrideSource overrideSource = mockBeanBlockOverrideSource();
        String datatype = "MyData";

        expect(overrideSource.getEditBlock(datatype)).andReturn(block);

        replay();

        BeanBlockSource source = new BeanBlockSourceImpl(cache, overrideSource, EMPTY_CONFIGURATION);

        Block actual = source.getEditBlock(datatype);

        assertSame(actual, block);

        verify();
    }
View Full Code Here

    }


    public Block getBlockForColumn()
    {
        Block override = overrides.getOverrideBlock(columnModel.getId() + "Header");

        if (override != null) return override;

        return standardHeader;
    }
View Full Code Here

        return overrideSource.hasDisplayBlock(datatype) || masterSource.hasDisplayBlock(datatype);
    }

    public Block getDisplayBlock(String datatype)
    {
        Block result = overrideSource.getDisplayBlock(datatype);

        if (result == null)
            result = masterSource.getDisplayBlock(datatype);

        if (result == null)
View Full Code Here

        return result;
    }

    public Block getEditBlock(String datatype)
    {
        Block result = overrideSource.getEditBlock(datatype);

        if (result == null)
            result = masterSource.getEditBlock(datatype);

        if (result == null)
View Full Code Here

    {
        Page page = newPage(PAGE_NAME);
        Component component = mockComponent();
        ComponentModel model = mockComponentModel();
        TypeCoercer coercer = mockTypeCoercer();
        Block block = mockBlock();

        Instantiator ins = newInstantiator(component, model);

        replay();
View Full Code Here

    {
        Page page = newPage(PAGE_NAME);
        Component component = mockComponent();
        ComponentModel model = mockComponentModel();
        TypeCoercer coercer = mockTypeCoercer();
        Block block1 = mockBlock();
        Block block2 = mockBlock();

        Instantiator ins = newInstantiator(component, model);

        replay();
View Full Code Here

     * Invoked from subclasses to do the rendering. The subclass controls the naming convention for locating an
     * overriding Block parameter (it is the name of the property possibly suffixed with a value).
     */
    protected Object renderPropertyValue(MarkupWriter writer, String overrideBlockId)
    {
        Block override = overrides.getBlockParameter(overrideBlockId);

        if (override != null) return override;

        String datatype = model.getDataType();

View Full Code Here

          throw new TransportException(uri,
              JGitText.get().startingReadStageWithoutWrittenRequestDataPendingIsNotSupported);
        }

        // Try to compress the content, but only if that is smaller.
        TemporaryBuffer buf = new TemporaryBuffer.Heap(http.postBuffer);
        try {
          GZIPOutputStream gzip = new GZIPOutputStream(buf);
          out.writeTo(gzip, null);
          gzip.close();
          if (out.length() < buf.length())
            buf = out;
        } catch (IOException err) {
          // Most likely caused by overflowing the buffer, meaning
          // its larger if it were compressed. Don't compress.
          buf = out;
        }

        openStream();
        if (buf != out)
          conn.setRequestProperty(HDR_CONTENT_ENCODING, ENCODING_GZIP);
        conn.setFixedLengthStreamingMode((int) buf.length());
        final OutputStream httpOut = conn.getOutputStream();
        try {
          buf.writeTo(httpOut, null);
        } finally {
          httpOut.close();
        }
      }
View Full Code Here

        e.write(dos);
      }
    }

    if (tree != null) {
      final TemporaryBuffer bb = new TemporaryBuffer.LocalFile();
      tree.write(tmp, bb);
      bb.close();

      NB.encodeInt32(tmp, 0, EXT_TREE);
      NB.encodeInt32(tmp, 4, (int) bb.length());
      dos.write(tmp, 0, 8);
      bb.writeTo(dos, null);
    }
    writeIndexChecksum = foot.digest();
    os.write(writeIndexChecksum);
    os.close();
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.util.TemporaryBuffer$Block

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.