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 ut 1221 #820

Merged
merged 35 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ sofa-ark-parent/support/ark-plugin-maven-plugin/com/alipay/sofa/ark/plugin/mark
sofa-ark-parent/support/ark-plugin-maven-plugin/null.ark.plugin
sofa-ark-parent/support/ark-plugin-maven-plugin/null.ark.plugin.bak
sofa-ark-parent/support/ark-plugin-maven-plugin/xxx.ark.plugin
*/temp dir/*
sofa-ark-parent/core/common/C/\temp dir\b\c/test.txt
2 changes: 0 additions & 2 deletions sofa-ark-parent/core-impl/container/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,5 @@
<artifactId>system-rules</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,8 @@ private boolean checkDeclaredWithCache(String libraryFile) {
return declaredCacheMap.computeIfAbsent(libraryFile, this::doCheckDeclared);
}

private boolean doCheckDeclared(String jarFilePath) {
boolean doCheckDeclared(String jarFilePath) {

// if from ark plugin, then set as declared
if (isFromPlugin(jarFilePath)) {
return true;
Expand Down Expand Up @@ -497,4 +498,4 @@ private boolean isFromPlugin(String jarFilePath) {
}
return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ public boolean validate(String command) {
return new BizCommand(command).isValidate();
}

private static final String HELP_MESSAGE = "Biz Command Tips:\n"
+ " USAGE: biz [option...] [arguments...]\n"
+ " SAMPLE: biz -m bizIdentityA bizIdentityB.\n"
+ " -h Shows the help message.\n"
+ " -a Shows all biz.\n"
+ " -m Shows the meta info of specified bizIdentity.\n"
+ " -s Shows the service info of specified bizIdentity.\n"
+ " -d Shows the detail info of specified bizIdentity.\n"
+ " -i Install biz of specified bizIdentity or bizUrl.\n"
+ " -u Uninstall biz of specified bizIdentity.\n"
+ " -o Switch biz of specified bizIdentity.\n";
static final String HELP_MESSAGE = "Biz Command Tips:\n"
+ " USAGE: biz [option...] [arguments...]\n"
+ " SAMPLE: biz -m bizIdentityA bizIdentityB.\n"
+ " -h Shows the help message.\n"
+ " -a Shows all biz.\n"
+ " -m Shows the meta info of specified bizIdentity.\n"
+ " -s Shows the service info of specified bizIdentity.\n"
+ " -d Shows the detail info of specified bizIdentity.\n"
+ " -i Install biz of specified bizIdentity or bizUrl.\n"
+ " -u Uninstall biz of specified bizIdentity.\n"
+ " -o Switch biz of specified bizIdentity.\n";

class BizCommand {
private boolean isValidate;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.alipay.sofa.ark.container.model;

import org.junit.Test;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.HashSet;

import static org.junit.Assert.*;

public class BizModelTest {

@Test
public void testDoCheckDeclared() throws MalformedURLException {

BizModel bizModel = new BizModel();
assertEquals(new HashSet(), bizModel.setAttribute("a", "b").setAttributes(new HashMap<>())
.getInjectExportPackages());
assertEquals(new HashSet(), bizModel.getInjectPluginDependencies());
bizModel.setCustomBizName("abc");
assertNotNull(bizModel.getAttributes());
assertNull(bizModel.getBizTempWorkDir());
bizModel.toString();

bizModel.setPluginClassPath(new URL[] { new URL("file://b/a.jar!/") });
assertTrue(bizModel.doCheckDeclared("file://b/a.jar!/b.jar"));
assertTrue(bizModel.doCheckDeclared(this.getClass().getClassLoader()
.getResource("test.jar").getPath()));
}
}
Loading
Loading