Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add enableLoggingFail option for failed introspect to FixtureMonkeyOptions #1069

Merged

Conversation

HanJaehee
Copy link
Contributor

Summary

add enableLoggingFail option for failed introspect warning log.
#1066

(Optional): Description

  • I used || due to overlapping parts with the existing enableLoggingFail option in the FailoverIntrospector.

How Has This Been Tested?

  • existing tests

Is the Document updated?

  • I also think it overlaps with the existing enableLoggingFail option, so I have omitted it for now.

@CLAassistant
Copy link

CLAassistant commented Oct 24, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ HanJaehee
❌ pop.con


pop.con seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@@ -60,6 +60,7 @@ public final class ArbitraryGeneratorContext implements Traceable {
private final int generateUniqueMaxTries;
private final AtomicReference<CombinableArbitrary<?>> generated =
new AtomicReference<>(CombinableArbitrary.NOT_GENERATED);
private final boolean enableLoggingFail;
Copy link
Contributor

@seongahjo seongahjo Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To prevent the breaking change, could you make a class ArbitraryGeneratorLoggingContext that includes enableLoggingFail?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public final class ArbitraryGeneratorLoggingContext {
    private final boolean enableLoggingFail;
    ...
    public boolean isEnableLoggingFail(){
        return enableLoggingFail;
    }
}
public final class ArbitraryGeneratorContext implements Traceable {
    ...
    private final ArbitraryGeneratorLoggingContext loggingContext;
    ...
    public ArbitraryGeneratorLoggingContext getLoggingContext() {
        return this.loggingContext;
    }
...
}
public final class BeanArbitraryIntrospector implements ArbitraryIntrospector {
    ...
    @Override
    public ArbitraryIntrospectorResult introspect(ArbitraryGeneratorContext context) {
        ArbitraryGeneratorLoggingContext loggingCotext = context.getLoggingContext();
        ...
        if(loggingContext.isEnableLoggingFail()){
        ...
        }
    }
    ...
}

Like this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, indeed

Comment on lines 155 to 157
public boolean isEnableLoggingFail() {
return enableLoggingFail;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be better to replace it with ArbitraryGeneratorLoggingContext.

@seongahjo seongahjo added this to the 1.0.28 milestone Oct 29, 2024
@HanJaehee HanJaehee force-pushed the feature/add_enable_logging_fail_option branch from 2715458 to f8992b1 Compare October 29, 2024 13:20
@@ -0,0 +1,14 @@
package com.navercorp.fixturemonkey.api.generator;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A license is needed.

/*
 * Fixture Monkey
 *
 * Copyright (c) 2021-present NAVER Corp.
 *
 * Licensed 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.navercorp.fixturemonkey.api.generator;


public final class ArbitraryGeneratorLoggingContext {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the annotation.
@API(since = "1.0.28", status = Status.EXPERIMENTAL)

Copy link
Contributor

@seongahjo seongahjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@seongahjo seongahjo merged commit 8bb16c2 into naver:main Nov 2, 2024
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants