예제 #1
0
END_TEST

START_TEST(test_admin_functions)
{
	struct hdfs_object *e;

	e = NULL;
	hdfs_finalizeUpgrade(h, &e);
	if (e)
#if 0
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
#else
		hdfs_object_free(e);
#endif

	hdfs_refreshNodes(h, &e);
	if (e)
#if 0
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
#else
		hdfs_object_free(e);
#endif

	hdfs_saveNamespace(h, &e);
	if (e)
#if 0
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
#else
		hdfs_object_free(e);
#endif
}
예제 #2
0
END_TEST

START_TEST(test_admin_functions2)
{
	struct hdfs_object *e, *e2;

	e = e2 = NULL;
	hdfs_metaSave(h, "/HADOOFUS_TEST_METASAVE", &e);
	(void)hdfs_delete(h, "/HADOOFUS_TEST_METASAVE", false, &e2);
	if (e2)
		hdfs_object_free(e2);
	if (e)
#if 0
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
#else
		hdfs_object_free(e);
#endif

	(void)hdfs_isFileClosed(h, "/BOGUS", &e);
	if (e)
		hdfs_object_free(e);

	hdfs_setBalancerBandwidth(h, 100000000, &e);
	if (e)
#if 0
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
#else
		hdfs_object_free(e);
#endif
}
예제 #3
0
END_TEST

START_TEST(test_getDatanodeReport)
{
	struct hdfs_object *e, *dns;

	e = dns = NULL;

	dns = hdfs_getDatanodeReport(h, HDFS_DNREPORT_ALL, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	else
		hdfs_object_free(dns);

	dns = hdfs_getDatanodeReport(h, HDFS_DNREPORT_LIVE, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	else
		hdfs_object_free(dns);

	dns = hdfs_getDatanodeReport(h, HDFS_DNREPORT_DEAD, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	else
		hdfs_object_free(dns);
}
예제 #4
0
END_TEST

START_TEST(test_addBlock)
{
	bool s;
	struct hdfs_object *e = NULL, *lb;
	const char *tf = "/HADOOFUS_TEST_ADDBLOCK",
	      *client = "HADOOFUS_CLIENT";

	// Create the file first
	hdfs_create(h, tf, 0644, client, true/*overwrite*/,
	    false/*createparent*/, 1/*replication*/, 64*1024*1024, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));

	mark_point();

	lb = hdfs_addBlock(h, tf, client, NULL, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert(!hdfs_object_is_null(lb));

	hdfs_object_free(lb);
	mark_point();

	// Cleanup
	s = hdfs_delete(h, tf, false/*recurse*/, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert_msg(s, "delete returned false");
}
예제 #5
0
END_TEST

START_TEST(test_recoverLease)
{
	bool s;
	struct hdfs_object *e = NULL;
	const char *tf = "/HADOOFUS_TEST_RECOVERLEASE",
	      *client = "HADOOFUS_CLIENT",
	      *client2 = "HADOOFUS_CLIENT_2";

	hdfs_create(h, tf, 0644, client, true/*overwrite*/,
	    false/*createparent*/, 1/*replication*/, 64*1024*1024, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));

	s = hdfs_recoverLease(h, tf, client2, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert_msg(!s, "recoverLease returned true");

	s = hdfs_delete(h, tf, false/*recurse*/, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert_msg(s, "delete returned false");
}
예제 #6
0
END_TEST

START_TEST(test_getContentSummary)
{
	bool s;
	struct hdfs_object *e = NULL, *cs;
	const char *tf = "/HADOOFUS_TEST_CSDIR";

	s = hdfs_mkdirs(h, tf, 0755, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert_msg(s, "mkdirs returned false");

	cs = hdfs_getContentSummary(h, tf, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert(!hdfs_object_is_null(cs));

	hdfs_object_free(cs);

	s = hdfs_delete(h, tf, false/*recurse*/, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert_msg(s, "delete returned false");
}
예제 #7
0
END_TEST

START_TEST(test_append)
{
	bool s;
	struct hdfs_object *e = NULL, *lb;
	const char *tf = "/HADOOFUS_TEST_APPEND",
	      *client = "HADOOFUS_CLIENT";

	// Create the file first
	hdfs_create(h, tf, 0644, client, true/*overwrite*/,
	    false/*createparent*/, 1/*replication*/, 64*1024*1024, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));

	s = hdfs_complete(h, tf, client, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert_msg(s, "complete returned false");

	// Open for appending
	lb = hdfs_append(h, tf, client, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));

	hdfs_object_free(lb);

	// Cleanup
	s = hdfs_delete(h, tf, false/*recurse*/, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert_msg(s, "delete returned false");
}
예제 #8
0
END_TEST

START_TEST(test_complete)
{
	bool s;
	struct hdfs_object *e = NULL;
	const char *tf = "/HADOOFUS_TEST_COMPLETE",
	      *client = "HADOOFUS_CLIENT";

	// Create the file first
	hdfs_create(h, tf, 0644, client, true/*overwrite*/,
	    false/*createparent*/, 1/*replication*/, 64*1024*1024, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));

	// XXX this must be updated to cover v2.0+ (last_block/fileid)
	s = hdfs_complete(h, tf, client, NULL, 0, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert_msg(s, "complete returned false");

	// Cleanup
	s = hdfs_delete(h, tf, false/*recurse*/, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert_msg(s, "delete returned false");
}
예제 #9
0
END_TEST

START_TEST(test_symlinks)
{
	const char *tl = "/HADOOFUS_TEST_SYMLINKS",
	      *td = "/HADOOFUS_TEST_BOGUS";
	struct hdfs_object *targ, *e, *e2, *fs;

	e = e2 = NULL;

	hdfs2_createSymlink(h, td, tl, 0755, false, &e);
	if (e)
		goto err;

	targ = hdfs2_getLinkTarget(h, tl, &e);
	if (e)
		goto err;
	hdfs_object_free(targ);

	fs = hdfs2_getFileLinkInfo(h, tl, &e);
	if (e)
		goto err;
	hdfs_object_free(fs);

err:
	hdfs_delete(h, tl, false, &e2);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	if (e2)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
}
예제 #10
0
END_TEST

START_TEST(test_setReplication)
{
	bool s;
	struct hdfs_object *e = NULL;
	const char *tf = "/HADOOFUS_TEST_SETREPLICATION",
	      *client = "HADOOFUS_CLIENT";

	// Create the file first
	hdfs_create(h, tf, 0644, client, true/*overwrite*/,
	    false/*createparent*/, 1/*replication*/, 64*1024*1024, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));

	s = hdfs_setReplication(h, tf, 2, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert_msg(s, "setReplication returned false");

	// Cleanup
	s = hdfs_delete(h, tf, false/*recurse*/, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert_msg(s, "delete returned false");
}
예제 #11
0
파일: hdfs.c 프로젝트: 13141516/hadoofus
/**
 * hdfsMove - Move file from one filesystem to another.
 *
 * @param srcFS The handle to source filesystem.
 * @param src The path of source file.
 * @param dstFS The handle to destination filesystem.
 * @param dst The path of destination file.
 * @return Returns 0 on success, -1 on error.
 */
int
hdfsMove(hdfsFS srcFS_, const char* src, hdfsFS dstFS, const char* dst)
{
	int res = -1;
	bool b;
	struct hdfs_object *ex = NULL;
	struct hdfsFS_internal *srcFS = srcFS_;
	char *src_abs, *dst_abs;

	src_abs = _makeabs(srcFS, src);
	dst_abs = _makeabs(dstFS, dst);

	// Yeah this comparison isn't perfect. We don't have anything better.
	if (srcFS_ == dstFS) {
		b = hdfs_rename(srcFS->fs_namenode, src_abs, dst_abs, &ex);
		if (ex) {
			ERR(EIO, "rename failed: %s", hdfs_exception_get_message(ex));
			goto out;
		}
		if (!b)
			WARN("rename of '%s' returned false", src_abs);
	} else {

		res = hdfsCopy(srcFS_, src_abs, dstFS, dst_abs);
		if (res == -1) {
			ERR(errno, "hdfsCopy failed");
			goto out;
		}

		b = hdfs_delete(srcFS->fs_namenode, src_abs, false/*recurse*/, &ex);
		if (ex) {
			ERR(EIO, "delete failed: %s", hdfs_exception_get_message(ex));
			goto out;
		}
		if (!b)
			WARN("delete of '%s' returned false", src_abs);
	}

	res = 0;
out:
	if (src_abs != src)
		free(src_abs);
	if (dst_abs != dst)
		free(dst_abs);
	if (ex)
		hdfs_object_free(ex);
	return res;
}
예제 #12
0
파일: hdfs.c 프로젝트: 13141516/hadoofus
/**
 * hdfsGetUsed - Return the total raw size of all files in the filesystem.
 *
 * @param fs The configured filesystem handle.
 * @return Returns the total-size; -1 on error.
 */
tOffset
hdfsGetUsed(hdfsFS fs)
{
	tOffset res = -1;
	struct hdfsFS_internal *client = fs;
	struct hdfs_object *ex = NULL, *stats_arr = NULL;

	stats_arr = hdfs_getStats(client->fs_namenode, &ex);
	if (ex) {
		ERR(EIO, "getStats(): %s", hdfs_exception_get_message(ex));
		goto out;
	}
	if (stats_arr->ob_type == H_NULL) {
		ERR(EIO, "getStats(): got bogus null array");
		goto out;
	}
	if (stats_arr->ob_val._array_long._len < 2) {
		ERR(EIO, "getStats(): got short stats array");
		goto out;
	}

	res = stats_arr->ob_val._array_long._vals[1];

out:
	if (stats_arr)
		hdfs_object_free(stats_arr);
	if (ex)
		hdfs_object_free(ex);
	return res;
}
예제 #13
0
파일: hdfs.c 프로젝트: 13141516/hadoofus
/**
 * hdfsSetReplication - Set the replication of the specified
 * file to the supplied value
 *
 * @param fs The configured filesystem handle.
 * @param path The path of the file.
 * @return Returns 0 on success, -1 on error.
 */
int
hdfsSetReplication(hdfsFS fs, const char* path, int16_t replication)
{
	int res = 0;
	struct hdfsFS_internal *client = fs;
	struct hdfs_object *ex = NULL;
	char *path_abs = _makeabs(fs, path);
	bool b;

	b = hdfs_setReplication(client->fs_namenode, path_abs, replication, &ex);
	if (ex) {
		ERR(EIO, "setReplication(): %s", hdfs_exception_get_message(ex));
		hdfs_object_free(ex);
		res = -1;
		goto out;
	}
	if (!b) {
		ERR(ENOENT, "setReplication(): No such file, or %s is a directory",
		    path_abs);
		res = -1;
		goto out;
	}

out:
	if (path_abs != path)
		free(path_abs);
	return res;
}
예제 #14
0
파일: hdfs.c 프로젝트: 13141516/hadoofus
/**
 * hdfsCreateDirectory - Make the given file and all non-existent
 * parents into directories.
 *
 * @param fs The configured filesystem handle.
 * @param path The path of the directory.
 * @return Returns 0 on success, -1 on error.
 */
int
hdfsCreateDirectory(hdfsFS fs, const char* path)
{
	int res = 0;
	struct hdfsFS_internal *client = fs;
	struct hdfs_object *ex = NULL;
	char *path_abs = _makeabs(fs, path);

	bool b = hdfs_mkdirs(client->fs_namenode, path_abs, 0755, &ex);
	if (ex) {
		ERR(EIO, "mkdirs(): %s", hdfs_exception_get_message(ex));
		hdfs_object_free(ex);
		res = -1;
		goto out;
	}
	if (!b) {
		ERR(EINVAL, "CreateDirectory() failed on '%s'", path_abs);
		res = -1;
		goto out;
	}

out:
	if (path_abs != path)
		free(path_abs);
	return res;
}
예제 #15
0
파일: hdfs.c 프로젝트: 13141516/hadoofus
/**
 * hdfsRename - Rename file.
 *
 * @param fs The configured filesystem handle.
 * @param oldPath The path of the source file.
 * @param newPath The path of the destination file.
 * @return Returns 0 on success, -1 on error.
 */
int
hdfsRename(hdfsFS fs, const char* oldPath, const char* newPath)
{
	struct hdfs_object *ex = NULL;
	bool b;
	struct hdfsFS_internal *client = fs;
	char *oldPath_abs, *newPath_abs;
	int res = 0;

	oldPath_abs = _makeabs(fs, oldPath);
	newPath_abs = _makeabs(fs, newPath);

	b = hdfs_rename(client->fs_namenode, oldPath_abs, newPath_abs, &ex);
	if (ex) {
		ERR(EIO, "rename(): %s", hdfs_exception_get_message(ex));
		hdfs_object_free(ex);
		res = -1;
		goto out;
	}
	
	if (!b) {
		ERR(EINVAL, "rename() failed (on '%s' -> '%s')", oldPath_abs, newPath_abs);
		res = -1;
		goto out;
	}

out:
	if (oldPath_abs != oldPath)
		free(oldPath_abs);
	if (newPath_abs != newPath)
		free(newPath_abs);
	return res;
}
예제 #16
0
파일: hdfs.c 프로젝트: 13141516/hadoofus
/**
 * hdfsExists - Checks if a given path exists on the filesystem
 *
 * @param fs The configured filesystem handle.
 * @param path The path to look for
 * @return Returns 0 on success, -1 on error.
 */
int
hdfsExists(hdfsFS fs, const char *path)
{
	struct hdfs_object *s, *ex = NULL;
	struct hdfsFS_internal *client = fs;
	int res = 0;
	char *path_abs = _makeabs(fs, path);

	s = hdfs_getFileInfo(client->fs_namenode, path_abs, &ex);
	if (ex) {
		ERR(EIO, "getFileInfo(): %s", hdfs_exception_get_message(ex));
		hdfs_object_free(ex);
		res = -1;
		goto out;
	}

	if (s->ob_type == H_NULL) {
		res = -1;
		errno = ENOENT;
	}

	hdfs_object_free(s);
out:
	if (path_abs != path)
		free(path_abs);
	return res;
}
예제 #17
0
파일: hdfs.c 프로젝트: 13141516/hadoofus
/**
 * hdfsGetPathInfo - Get information about a path as a (dynamically
 * allocated) single hdfsFileInfo struct. hdfsFreeFileInfo should be
 * called when the pointer is no longer needed.
 *
 * @param fs The configured filesystem handle.
 * @param path The path of the file.
 * @return Returns a dynamically-allocated hdfsFileInfo object;
 *     NULL on error.
 */
hdfsFileInfo*
hdfsGetPathInfo(hdfsFS fs, const char* path)
{
	hdfsFileInfo *res = NULL;
	struct hdfsFS_internal *client = fs;
	struct hdfs_object *ex = NULL, *fstatus = NULL;
	char *path_abs = _makeabs(fs, path);

	fstatus = hdfs_getFileInfo(client->fs_namenode, path_abs, &ex);
	if (ex) {
		ERR(EIO, "getFileInfo(): %s", hdfs_exception_get_message(ex));
		hdfs_object_free(ex);
		goto out;
	}
	if (fstatus->ob_type == H_NULL) {
		ERR(ENOENT, "getFileInfo(): %s doesn't exist", path_abs);
		goto out;
	}

	res = malloc(sizeof *res);
	assert(res);

	_hadoofus_file_status_to_libhdfs(client->fs_uri, path_abs, fstatus, res);

out:
	if (fstatus)
		hdfs_object_free(fstatus);
	if (path_abs != path)
		free(path_abs);
	return res;
}
예제 #18
0
END_TEST

START_TEST(test_delegationTokens)
{
	struct hdfs_object *token, *e;

	e = NULL;

	token = hdfs_getDelegationToken(h, "abcde", &e);
	if (e) {
		/*
		 * "Delegation Token can be issued only with kerberos or web
		 * authentication"
		 */
#if 0
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
#else
		hdfs_object_free(e);
		e = NULL;
		token = hdfs_token_new_empty();
#endif
	}

	(void)hdfs_renewDelegationToken(h, token, &e);
	if (e) {
		/* Similar error. */
#if 0
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
#else
		hdfs_object_free(e);
		e = NULL;
#endif
	}

	hdfs_cancelDelegationToken(h, token, &e);
	if (e) {
		/* Similar error. */
#if 0
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
#else
		hdfs_object_free(e);
		e = NULL;
#endif
	}

	hdfs_object_free(token);
}
예제 #19
0
END_TEST

START_TEST(test_mkdirs)
{
	bool s;
	struct hdfs_object *e = NULL;
	const char *tf = "/HADOOFUS_TEST_MKDIRS";

	s = hdfs_mkdirs(h, tf, 0755, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert_msg(s, "mkdirs returned false");

	s = hdfs_delete(h, tf, false/*recurse*/, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert_msg(s, "delete returned false");
}
예제 #20
0
END_TEST

START_TEST(test_abandonBlock)
{
	bool s;
	struct hdfs_object *e = NULL, *lb, *bl;
	const char *tf = "/HADOOFUS_TEST_ABANDONBLOCK",
	      *client = "HADOOFUS_CLIENT";

	// Create the file first
	hdfs_create(h, tf, 0644, client, true/*overwrite*/,
	    false/*createparent*/, 1/*replication*/, 64*1024*1024, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));

	mark_point();

	// XXX this must be updated to cover v2.0+ (last_block/fileid)
	lb = hdfs_addBlock(h, tf, client, NULL, NULL, 0, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert(!hdfs_object_is_null(lb));

	mark_point();

	bl = hdfs_block_from_located_block(lb);
	hdfs_object_free(lb);

	mark_point();

	hdfs_abandonBlock(h, bl, tf, client, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));

	hdfs_object_free(bl);
	mark_point();

	// Cleanup
	s = hdfs_delete(h, tf, false/*recurse*/, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert_msg(s, "delete returned false");
}
예제 #21
0
END_TEST

START_TEST(test_renewLease)
{
	struct hdfs_object *e = NULL;

	hdfs_renewLease(h, "HADOOFUS_CLIENT", &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
}
예제 #22
0
END_TEST

START_TEST(test_getBlockLocations)
{
	struct hdfs_object *e = NULL, *bls;
	bls = hdfs_getBlockLocations(h, "/", 0L, 1000L, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert_msg(hdfs_object_is_null(bls));
	ck_assert_msg(hdfs_null_type(bls) == H_LOCATED_BLOCKS);
}
예제 #23
0
END_TEST

START_TEST(test_getServerDefaults)
{
	struct hdfs_object *object, *e = NULL;

	object = hdfs2_getServerDefaults(h, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));

	hdfs_object_free(object);
}
예제 #24
0
END_TEST

START_TEST(test_getStats)
{
	struct hdfs_object *e = NULL, *stats;

	stats = hdfs_getStats(h, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));

	hdfs_object_free(stats);
}
예제 #25
0
END_TEST

START_TEST(test_setSafeMode)
{
	struct hdfs_object *e;
	bool b;

	e = NULL;
	b = hdfs_setSafeMode(h, HDFS_SAFEMODE_GET, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));

	b = hdfs_setSafeMode(h, HDFS_SAFEMODE_ENTER, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));

	b = hdfs_setSafeMode(h, HDFS_SAFEMODE_LEAVE, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));

	(void)b;
}
예제 #26
0
END_TEST

START_TEST(test_getFileInfo)
{
	struct hdfs_object *e = NULL, *fs;

	fs = hdfs_getFileInfo(h, "/", &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert(!hdfs_object_is_null(fs));

	hdfs_object_free(fs);
}
예제 #27
0
END_TEST

START_TEST(test_getListing)
{
	struct hdfs_object *e = NULL, *listing;

	listing = hdfs_getListing(h, "/", NULL, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert(!hdfs_object_is_null(listing));

	hdfs_object_free(listing);
}
예제 #28
0
END_TEST

START_TEST(test_distributedUpgradeProgress)
{
	struct hdfs_object *e, *us;

	e = NULL;

	us = hdfs_distributedUpgradeProgress(h, HDFS_UPGRADEACTION_STATUS, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	hdfs_object_free(us);

	us = hdfs_distributedUpgradeProgress(h, HDFS_UPGRADEACTION_DETAILED, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	hdfs_object_free(us);

#if 0
	us = hdfs_distributedUpgradeProgress(HDFS_UPGRADEACTION_FORCE_PROCEED);
#endif
}
예제 #29
0
END_TEST

START_TEST(test_getBlockLocations2)
{
	struct hdfs_object *e = NULL, *e2 = NULL, *bls;
	const char *tf = "/HADOOFUS_TEST_GET_BLOCK_LOCATIONS2",
	      *client = "HADOOFUS_CLIENT";

	hdfs_create(h, tf, 0644, client, true/*overwrite*/,
	    false/*createparent*/, 1/*replication*/, 64*1024*1024, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));

	bls = hdfs_getBlockLocations(h, tf, 0L, 1000L, &e);
	hdfs_delete(h, tf, false/*recurse*/, &e2);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	if (e2)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e2));

	ck_assert_msg(bls->ob_type == H_LOCATED_BLOCKS);
}
예제 #30
0
END_TEST

START_TEST(test_setTimes)
{
	bool s;
	struct hdfs_object *e = NULL;
	const char *tf = "/HADOOFUS_TEST_SETTIMES",
	      *client = "HADOOFUS_CLIENT";

	hdfs_create(h, tf, 0644, client, true/*overwrite*/,
	    false/*createparent*/, 1/*replication*/, 64*1024*1024, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));

	hdfs_setTimes(h, tf, -1, -1, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));

	s = hdfs_delete(h, tf, false/*recurse*/, &e);
	if (e)
		ck_abort_msg("exception: %s", hdfs_exception_get_message(e));
	ck_assert_msg(s, "delete returned false");
}