Skip to content
Closed
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
dceff5b
build(deps): update dependency com.google.cloud:native-image-shared-c…
renovate-bot Jan 25, 2025
e2c988e
disable testDisconnectShouldNotWaitToReadResponse for JDK >= 23
diegomarquezp Jan 28, 2025
d355740
fix assumption code
diegomarquezp Jan 28, 2025
2fbd4cb
fix assumption ii
diegomarquezp Jan 28, 2025
e525298
Revert "fix assumption ii"
diegomarquezp Jan 28, 2025
42958ef
Revert "fix assumption code"
diegomarquezp Jan 28, 2025
a74d12c
Revert "disable testDisconnectShouldNotWaitToReadResponse for JDK >= 23"
diegomarquezp Jan 28, 2025
e648262
Merge branch 'main' into renovate/com.google.cloud-native-image-share…
diegomarquezp Jan 28, 2025
7599092
chore: use JUnit4 in tests
diegomarquezp Jan 31, 2025
84f3f4f
use at least 1 Junit38 test
diegomarquezp Jan 31, 2025
c9eb627
Revert "use at least 1 Junit38 test"
diegomarquezp Jan 31, 2025
74d8487
fix net http response tests
diegomarquezp Jan 31, 2025
dbdba31
annotate tests with @RunWith(JUnit4.class)
diegomarquezp Feb 3, 2025
2ba8ac0
initialize static members in static block
diegomarquezp Feb 4, 2025
22e0f17
use static blocks to initialize test classes
diegomarquezp Feb 4, 2025
4c4d719
format
diegomarquezp Feb 4, 2025
905c8f3
set up class initialization
diegomarquezp Feb 4, 2025
d78c642
convert google-http-client-test to JUnit4
diegomarquezp Feb 4, 2025
f3b785e
Merge branch 'renovate/com.google.cloud-native-image-shared-config-1.…
diegomarquezp Feb 4, 2025
e99ea38
use java.nio for tests
diegomarquezp Feb 5, 2025
9faa908
Merge branch 'renovate/com.google.cloud-native-image-shared-config-1.…
diegomarquezp Feb 5, 2025
e7bd4e1
run with JUnit 4 explicitly
diegomarquezp Feb 5, 2025
3121f60
Merge branch 'renovate/com.google.cloud-native-image-shared-config-1.…
diegomarquezp Feb 5, 2025
73ebee2
use static block
diegomarquezp Feb 5, 2025
8205011
Merge branch 'renovate/com.google.cloud-native-image-shared-config-1.…
diegomarquezp Feb 5, 2025
06acc4a
Revert "use static block"
diegomarquezp Feb 5, 2025
c388a04
Reapply "use static block"
diegomarquezp Feb 5, 2025
6b0a708
initialize IS_WINDOWS at build time
diegomarquezp Feb 5, 2025
9455b69
Merge branch 'renovate/com.google.cloud-native-image-shared-config-1.…
diegomarquezp Feb 5, 2025
c70dbd1
prevent cryptic message when initializing FileDataStoreFactory
diegomarquezp Feb 5, 2025
3b27435
Merge branch 'renovate/com.google.cloud-native-image-shared-config-1.…
diegomarquezp Feb 5, 2025
4e507a0
fix static initialization in AbstractDatastoreFactory
diegomarquezp Feb 5, 2025
3f6483d
test no IS_WINDOWS
diegomarquezp Feb 5, 2025
e646c47
Revert "test no IS_WINDOWS"
diegomarquezp Feb 5, 2025
70b2b15
ruling out logger initialization
diegomarquezp Feb 5, 2025
0d0f4d7
add test output
diegomarquezp Feb 5, 2025
937aabf
safe initialization of ID_PATTERN
diegomarquezp Feb 5, 2025
c9fb4bf
remove provided scope depdendency
diegomarquezp Feb 5, 2025
7b5d600
convert appengine transport to JUnit 4
diegomarquezp Feb 5, 2025
25c6523
Merge branch 'renovate/com.google.cloud-native-image-shared-config-1.…
diegomarquezp Feb 5, 2025
0b346a1
add clirr differences
diegomarquezp Feb 6, 2025
c5f76a1
include appengine classes in runtime
diegomarquezp Feb 6, 2025
7e35ed1
add native config
diegomarquezp Feb 6, 2025
8e90738
add reflect-config for appengine
diegomarquezp Feb 6, 2025
bf74443
use JUnit4 in GSON tests
diegomarquezp Feb 6, 2025
818da9a
fix clirr
diegomarquezp Feb 6, 2025
d6f991c
port abstract json parser test to JUnit4
diegomarquezp Feb 6, 2025
1322e42
remove unused imports
diegomarquezp Feb 6, 2025
3b8c44c
update clirr again
diegomarquezp Feb 6, 2025
bf0c6b4
add native config to gson module
diegomarquezp Feb 6, 2025
411304b
convert jackson module to JUnit4
diegomarquezp Feb 6, 2025
fff197f
Merge branch 'renovate/com.google.cloud-native-image-shared-config-1.…
diegomarquezp Feb 6, 2025
dfb48fe
Merge branch 'renovate/com.google.cloud-native-image-shared-config-1.…
diegomarquezp Feb 6, 2025
f787ea4
make jackson factory instantiation native friendly
diegomarquezp Feb 6, 2025
505f931
config test-only build-time initialization
diegomarquezp Feb 6, 2025
94aab38
adapt protocol buffers module to JUnit 4
diegomarquezp Feb 6, 2025
9ad8269
Merge branch 'renovate/com.google.cloud-native-image-shared-config-1.…
diegomarquezp Feb 6, 2025
35543d3
initialize test classes at test time
diegomarquezp Feb 6, 2025
715fc0d
convert xml module to JUnit4
diegomarquezp Feb 6, 2025
de7a0b5
Merge branch 'renovate/com.google.cloud-native-image-shared-config-1.…
diegomarquezp Feb 6, 2025
dd335e8
add test time initialization entries to xml module
diegomarquezp Feb 6, 2025
6209970
format
diegomarquezp Feb 6, 2025
3d4c01f
restore debug setup
diegomarquezp Feb 6, 2025
448d178
Merge branch 'renovate/com.google.cloud-native-image-shared-config-1.…
diegomarquezp Feb 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .kokoro/presubmit/graalvm-native-a.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ env_vars: {
}

container_properties {
docker_image: "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_a:1.13.0"
docker_image: "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_a:1.14.0"
}
2 changes: 1 addition & 1 deletion .kokoro/presubmit/graalvm-native-b.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ env_vars: {
}

container_properties {
docker_image: "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_b:1.13.0"
docker_image: "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_b:1.14.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,56 @@

package com.google.api.client.test.util.store;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import com.google.api.client.util.Beta;
import com.google.api.client.util.store.DataStore;
import com.google.api.client.util.store.DataStoreFactory;
import com.google.common.collect.Sets;
import java.util.Arrays;
import java.util.Collection;
import java.util.Set;
import junit.framework.TestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
* Tests {@link DataStoreFactory}.
*
* @author Yaniv Inbar
*/
@Beta
public abstract class AbstractDataStoreFactoryTest extends TestCase {
@RunWith(JUnit4.class)
public abstract class AbstractDataStoreFactoryTest {

private static final String STRING_ID;
private static final String BOOLEAN_ID;

private static final String STRING_ID = "String";
private static final String BOOLEAN_ID = "Boolean";
static {
STRING_ID = "String";
BOOLEAN_ID = "Boolean";
}
DataStoreFactory dataStore;
DataStore<String> stringTyped;
DataStore<Boolean> boolTyped;

/** Returns a new instance of the data store factory to test. */
protected abstract DataStoreFactory newDataStoreFactory() throws Exception;

@Override
@Before
public void setUp() throws Exception {
dataStore = newDataStoreFactory();
stringTyped = dataStore.getDataStore(STRING_ID);
boolTyped = dataStore.getDataStore(BOOLEAN_ID);
}

@Override
@After
public void tearDown() throws Exception {
stringTyped.clear();
assertTrue(stringTyped.values().isEmpty());
Expand All @@ -59,6 +75,7 @@ private static void assertContentsAnyOrder(Collection<?> c, Object... elts) {
assertEquals(Sets.newHashSet(c), Sets.newHashSet(Arrays.asList(elts)));
}

@Test
public void testId() throws Exception {
subtestIdNoException("1");
subtestIdNoException("123456789012345678901234567890");
Expand All @@ -83,6 +100,7 @@ private void subtestIdNoException(String id) throws Exception {
newDataStoreFactory().getDataStore(id);
}

@Test
public void testSet() throws Exception {
// get null
assertNull(stringTyped.get(null));
Expand Down Expand Up @@ -123,6 +141,7 @@ public void testSet() throws Exception {
assertTrue(boolTyped.get("k"));
}

@Test
public void testValues() throws Exception {
// before
assertTrue(stringTyped.values().isEmpty());
Expand All @@ -144,6 +163,7 @@ public void testValues() throws Exception {
assertContentsAnyOrder(boolTyped.values(), true);
}

@Test
public void testKeySet() throws Exception {
// before
assertTrue(stringTyped.keySet().isEmpty());
Expand All @@ -164,6 +184,7 @@ public void testKeySet() throws Exception {
assertTrue(stringTyped.keySet().isEmpty());
}

@Test
public void testDelete() throws Exception {
// store with basic values
stringTyped.set("k", "v").set("k2", "v2");
Expand All @@ -186,6 +207,7 @@ public void testDelete() throws Exception {
assertEquals(0, stringTyped.size());
}

@Test
public void testClear() throws Exception {
// store with basic values
stringTyped.set("k", "v").set("k2", "v2");
Expand All @@ -199,6 +221,7 @@ public void testClear() throws Exception {
assertEquals(0, stringTyped.size());
}

@Test
public void testLarge() throws Exception {
// TODO(yanivi): size = 1000? need to speed up JdoDataStoreTest first
int size = 100;
Expand All @@ -210,6 +233,7 @@ public void testLarge() throws Exception {
assertEquals("hello" + mid, stringTyped.get(String.valueOf(mid)));
}

@Test
public void testContainsKeyAndValue() throws Exception {
// before
assertFalse(stringTyped.containsKey("k"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,35 @@

package com.google.api.client.test.util.store;

import static java.nio.file.Files.createTempDirectory;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import com.google.api.client.util.store.DataStore;
import com.google.api.client.util.store.FileDataStoreFactory;
import com.google.common.collect.ImmutableSet;
import com.google.common.io.Files;
import java.io.File;
import java.io.IOException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
* Tests {@link FileDataStoreFactory}.
*
* @author Yaniv Inbar
*/
@RunWith(JUnit4.class)
public class FileDataStoreFactoryTest extends AbstractDataStoreFactoryTest {

@Override
protected FileDataStoreFactory newDataStoreFactory() throws IOException {
File dataDir = Files.createTempDir();
File dataDir = createTempDirectory("temp").toFile();
dataDir.deleteOnExit();
return new FileDataStoreFactory(dataDir);
}

@Test
public void testSave() throws IOException {
FileDataStoreFactory factory = newDataStoreFactory();
DataStore<String> store = factory.getDataStore("foo");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ public abstract class AbstractDataStoreFactory implements DataStoreFactory {
* Pattern to control possible values for the {@code id} parameter of {@link
* #getDataStore(String)}.
*/
private static final Pattern ID_PATTERN = Pattern.compile("\\w{1,30}");
private static final Pattern ID_PATTERN;

static {
ID_PATTERN = Pattern.compile("\\w{1,30}");
}

public final <V extends Serializable> DataStore<V> getDataStore(String id) throws IOException {
Preconditions.checkArgument(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.Serializable;
import java.lang.System.Logger.Level;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand All @@ -37,6 +38,7 @@
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import java.util.logging.Logger;

/**
* Thread-safe file implementation of a credential store.
Expand All @@ -54,8 +56,16 @@
*/
public class FileDataStoreFactory extends AbstractDataStoreFactory {

private static final boolean IS_WINDOWS =
StandardSystemProperty.OS_NAME.value().toLowerCase(Locale.ENGLISH).startsWith("windows");
private static final boolean IS_WINDOWS;
static {
try {
IS_WINDOWS =
StandardSystemProperty.OS_NAME.value().toLowerCase(Locale.ENGLISH).startsWith("windows");
} catch (Throwable ex) {
Logger.getLogger(FileDataStoreFactory.class.getName()).severe(ex.getMessage());
throw ex;
}
}

/** Directory to store data. */
private final File dataDirectory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,23 @@

package com.google.api.client.http;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.io.IOException;
import java.io.OutputStream;
import java.util.Arrays;
import junit.framework.TestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
* Tests {@link AbstractHttpContent}.
*
* @author Yaniv Inbar
*/
public class AbstractHttpContentTest extends TestCase {
@RunWith(JUnit4.class)
public class AbstractHttpContentTest {

static class TestHttpContent extends AbstractHttpContent {

Expand Down Expand Up @@ -54,11 +60,13 @@ public boolean retrySupported() {
}
}

@Test
public void testRetrySupported() {
AbstractHttpContent content = new TestHttpContent(true, 0);
assertTrue(content.retrySupported());
}

@Test
public void testComputeLength() throws Exception {
subtestComputeLength(true, 0, 0);
subtestComputeLength(true, 1, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,40 @@

package com.google.api.client.http;

import static org.junit.Assert.assertEquals;

import com.google.api.client.testing.http.HttpTesting;
import com.google.api.client.testing.http.MockHttpTransport;
import junit.framework.TestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
* Tests {@link BasicAuthentication}.
*
* @author Yaniv Inbar
*/
public class BasicAuthenticationTest extends TestCase {

static final String USERNAME = "Aladdin";
@RunWith(JUnit4.class)
public class BasicAuthenticationTest {

static final String PASSWORD = "open sesame";
static final String USERNAME;
static final String PASSWORD;
static final String AUTH_HEADER;

static final String AUTH_HEADER = "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==";
static {
USERNAME = "Aladdin";
PASSWORD = "open sesame";
AUTH_HEADER = "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==";
}

@Test
public void testConstructor() {
BasicAuthentication auth = new BasicAuthentication(USERNAME, PASSWORD);
assertEquals(USERNAME, auth.getUsername());
assertEquals(PASSWORD, auth.getPassword());
}

@Test
public void testInitialize() throws Exception {
BasicAuthentication auth = new BasicAuthentication(USERNAME, PASSWORD);
HttpRequest request =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,32 @@

package com.google.api.client.http;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import com.google.api.client.util.IOUtils;
import com.google.api.client.util.StringUtils;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import junit.framework.TestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
* Tests {@link ByteArrayContent}.
*
* @author Yaniv Inbar
*/
public class ByteArrayContentTest extends TestCase {
private static final byte[] FOO = StringUtils.getBytesUtf8("foo");
@RunWith(JUnit4.class)
public class ByteArrayContentTest {
private static final byte[] FOO;

static {
FOO = StringUtils.getBytesUtf8("foo");
}

@Test
public void testConstructor() throws IOException {
subtestConstructor(new ByteArrayContent("type", FOO), "foo");
subtestConstructor(new ByteArrayContent("type", FOO, 0, 3), "foo");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
public class ConsumingInputStreamTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,25 @@

package com.google.api.client.http;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import junit.framework.TestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
* Tests {@link EmptyContent}.
*
* @author Yaniv Inbar
*/
public class EmptyContentTest extends TestCase {
@RunWith(JUnit4.class)
public class EmptyContentTest {

@Test
public void test() throws IOException {
EmptyContent content = new EmptyContent();
assertEquals(0L, content.getLength());
Expand Down
Loading