Package org.cloudfoundry.client.lib.domain

Examples of org.cloudfoundry.client.lib.domain.CloudResources$Serializer


   *
   * @param conf Configuration to use
   * @return A new, configured, Serializer
   */
  public Serializer createSerializer(Configuration conf) {
    Serializer serializer = ReflectionUtils.newInstance(serializerClass, conf);
    SerDes.initSerializer(serializer, conf, columnInfo, serializerParams);
    return serializer;
  }
View Full Code Here


    OutputInfo oti = outputConf.readOutputTableInfo();

    HiveUtils.setRCileNumColumns(conf, oti.getColumnInfo().size());
    HadoopUtils.setOutputKeyWritableClass(conf, NullWritable.class);

    Serializer serializer = oti.createSerializer(conf);
    HadoopUtils.setOutputValueWritableClass(conf,
        serializer.getSerializedClass());

    org.apache.hadoop.mapred.OutputFormat baseOutputFormat =
        ReflectionUtils.newInstance(oti.getOutputFormatClass(), conf);
    // CHECKSTYLE: stop LineLength
    org.apache.hadoop.mapred.RecordWriter<WritableComparable, Writable> baseWriter =
View Full Code Here

    HiveOutputFormat<?, ?> hiveOutputFormat = null;
    Class<? extends Writable> outputClass = null;
    boolean isCompressed = conf.getCompressed();
    TableDesc tableInfo = conf.getTableInfo();
    try {
      Serializer serializer = (Serializer) tableInfo.getDeserializerClass().newInstance();
      serializer.initialize(null, tableInfo.getProperties());
      outputClass = serializer.getSerializedClass();
      hiveOutputFormat = conf.getTableInfo().getOutputFileFormatClass().newInstance();
    } catch (SerDeException e) {
      throw new HiveException(e);
    } catch (InstantiationException e) {
      throw new HiveException(e);
View Full Code Here

    @Test
    public void shouldPackOnlyMissingResources() throws Exception {
        ZipFile zipFile = new ZipFile(SampleProjects.springTravel());
        try {
            ApplicationArchive archive = new ZipApplicationArchive(zipFile);
            CloudResources allResources = new CloudResources(archive);
            List<CloudResource> resources = new ArrayList<CloudResource>(allResources.asList());
            resources.remove(0);
            CloudResources knownRemoteResources = new CloudResources(resources);
            UploadApplicationPayload payload = new UploadApplicationPayload(archive, knownRemoteResources);
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            FileCopyUtils.copy(payload.getInputStream(), bos);
            assertThat(payload.getArchive(), is(archive));
            assertThat(payload.getTotalUncompressedSize(), is(93));
View Full Code Here

    private ObjectMapper mapper = new ObjectMapper();

    @Test
    public void shouldSerialize() throws Exception {
        CloudResource r = new CloudResource("index.html", 93L, SHA);
        CloudResources o = new CloudResources(Collections.singleton(r));
        String s = mapper.writeValueAsString(o);
        assertThat(s, is(equalTo(JSON)));
    }
View Full Code Here

        assertThat(s, is(equalTo(JSON)));
    }

    @Test
    public void shouldDeserialize() throws JsonParseException, JsonMappingException, IOException {
        CloudResources o = mapper.readValue(JSON, CloudResources.class);
        List<CloudResource> l = o.asList();
        assertThat(l.size(), is(1));
        CloudResource r = l.get(0);
        assertThat(r.getFilename(), is("index.html"));
        assertThat(r.getSha1(), is(SHA));
        assertThat(r.getSize(), is(93L));
View Full Code Here

    }

    @Test
    public void shouldCreateFromIterator() throws Exception {
        Iterator<? extends CloudResource> i = Collections.singleton(new CloudResource("index.html", 93L, SHA)).iterator();
        CloudResources o = new CloudResources(i);
        List<CloudResource> l = o.asList();
        assertThat(l.size(), is(1));
        CloudResource r = l.get(0);
        assertThat(r.getFilename(), is("index.html"));
        assertThat(r.getSha1(), is(SHA));
        assertThat(r.getSize(), is(93L));
View Full Code Here

    @Test
    public void shouldGetFromArchive() throws Exception {
        ZipFile zipFile = new ZipFile(SampleProjects.springTravel());
        try {
            ApplicationArchive archive = new ZipApplicationArchive(zipFile);
            CloudResources o = new CloudResources(archive);
            List<CloudResource> l = o.asList();
            assertThat(l.size(), is(96));
            assertThat(l.get(0).getFilename(), is("index.html"));
        } finally {
            zipFile.close();
        }
View Full Code Here

    @Test
    public void shouldGetFilenames() throws Exception {
        List<CloudResource> resources = new ArrayList<CloudResource>();
        resources.add(new CloudResource("1", 93L, SHA));
        resources.add(new CloudResource("2", 93L, SHA));
        CloudResources o = new CloudResources(resources);
        Set<String> expected = new HashSet<String>(Arrays.asList("1", "2"));
        assertThat(o.getFilenames(), is(expected));
    }
View Full Code Here

    UUID appId = getAppId(appName);

    if (callback == null) {
      callback = UploadStatusCallback.NONE;
    }
    CloudResources knownRemoteResources = getKnownRemoteResources(archive);
    callback.onCheckResources();
    callback.onMatchedFileNames(knownRemoteResources.getFilenames());
    UploadApplicationPayload payload = new UploadApplicationPayload(archive, knownRemoteResources);
    callback.onProcessMatchedResources(payload.getTotalUncompressedSize());
    HttpEntity<?> entity = generatePartialResourceRequest(payload, knownRemoteResources);
    ResponseEntity<Map<String,Map<String,String>>> responseEntity =
                getRestTemplate().exchange(getUrl("/v2/apps/{guid}/bits?async=true"), HttpMethod.PUT, entity,
View Full Code Here

TOP

Related Classes of org.cloudfoundry.client.lib.domain.CloudResources$Serializer

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.